-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4229457
Showing
11 changed files
with
653 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/bin/ | ||
.classpath | ||
.project | ||
.settings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
## 简介 | ||
|
||
一款简单的照片整理的工具,主要用于查看照片的基本信息以及将多个不同目录的照片合并在一起。 | ||
|
||
## 使用事例 | ||
|
||
### 查看帮助 | ||
|
||
➜ PhotoManager git:(master) ✗ java -jar ./managePhoto.jar | ||
usage: | ||
|
||
java -jar ./managePhoto.jar --<show|manage> [filePath] | ||
java -jar ./managePhoto.jar --version | ||
java -jar ./managePhoto.jar --help | ||
|
||
such as: | ||
|
||
java -jar ./getImgInfo.jar --version | ||
|
||
java -jar ./managePhoto.jar --show ~/temp/IMG_3555.jpg | ||
|
||
### 查看版本 | ||
|
||
|
||
➜ PhotoManager git:(master) ✗ java -jar ./managePhoto.jar --version | ||
class com.bihe0832.photo.getPhotoInfo version 1.0.0 (1) | ||
|
||
homepage : https://github.com/bihe0832/PhotoManager | ||
blog : http://blog.bihe0832.com | ||
github : https://github.com/bihe0832 | ||
|
||
|
||
### 查看照片信息 | ||
|
||
➜ PhotoManager git:(master) ✗ java -jar ./managePhoto.jar --show ~/temp/IMG_3555.jpg | ||
照片信息如下: | ||
****************************************************** | ||
照片的当前名称: IMG_3555.jpg | ||
照片的当前路径: /Volumes/Document/Document/temp/IMG_3555.jpg | ||
照片的空间大小: 2020 KB | ||
照片的像素大小: 3264 pixels * 2448 pixels | ||
拍摄时当地时间: 2017:05:22 18:19:28 | ||
拍摄时标准时间: 2017:05:22 10:19:28.00 UTC | ||
拍摄时地点经纬: 100° 16' 51.73" E ,28° 53' 55.01" N | ||
拍摄时地点海拔: Sea level:4519 metres | ||
拍摄时使用设备: Apple (iPhone 6) | ||
****************************************************** | ||
|
||
### 整理照片 | ||
|
||
➜ PhotoManager git:(master) ✗ java -jar ./managePhoto.jar --manage /Volumes/Document/Document/temp/1/ /Volumes/Document/Document/temp/5/ | ||
|
||
|
||
****************************************************** | ||
照片整理已经开始…… | ||
如果照片较多,持续时间较长,请耐心等待。 | ||
整理过程中您可以在目标目录实时查看整理效果 | ||
|
||
|
||
正在努力整理中,已完成: /Volumes/Document/Document/temp/1/目录下 5 张照片 | ||
|
||
|
||
|
||
****************************************************** | ||
照片整理结果如下:共计从: /Volumes/Document/Document/temp/1/整理了 8 张照片,其中: | ||
整理成功: 8 张 | ||
: 0 张为已经存在的照片 | ||
: 8 张已经按时间重新命名 | ||
: 0 张保留了原名称 | ||
整理失败: 0 张 | ||
: 0 张照片没有找到 | ||
: 0 张照片解析时间错误,需要手动整理 | ||
****************************************************** |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/bin/ | ||
.classpath | ||
.project |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
### 查看帮助 | ||
|
||
➜ getPNGInfo git:(master) ✗ java -jar ./getImgInfo.jar | ||
usage: | ||
|
||
java -jar ./getImgInfo.jar <command> [filePath] | ||
java -jar ./getImgInfo.jar --version | ||
java -jar ./getImgInfo.jar --help | ||
|
||
such as: | ||
|
||
|
||
java -jar ./getImgInfo.jar ./test.png | ||
java -jar ./getImgInfo.jar --version | ||
java -jar ./getImgInfo.jar --help | ||
|
||
after check,the result will be a string json such as: | ||
|
||
{"ret":0,"msg":"图片是否有渐变: true ,图片尺寸为(宽*高): 432 * 168 , 图片类型: 6","hasAlpha":true,"type":6,"width":432,"height":168} | ||
### 查看版本 | ||
|
||
➜ getPNGInfo git:(master) ✗ java -jar ./getImgInfo.jar --version | ||
class com.bihe0832.png.getImgInfo version 1.0.1 (2) | ||
|
||
homepage : https://github.com/bihe0832/getImageInfo | ||
blog : http://blog.bihe0832.com | ||
github : https://github.com/bihe0832 | ||
### 查看图片信息 | ||
|
||
➜ getPNGInfo git:(master) ✗ java -jar ./getImgInfo.jar head.jpg | ||
{"ret":0,"msg":"图片是否有渐变: false ,图片尺寸为(宽*高): 344 * 344 , 图片大小: 7 KB,图片类型: 5","hasAlpha":false,"type":5,"width":344,"height":344,"size":7} | ||
|
||
➜ getPNGInfo git:(master) ✗ java -jar ./getImgInfo.jar head.png | ||
{"ret":0,"msg":"图片是否有渐变: true ,图片尺寸为(宽*高): 344 * 344 , 图片大小: 33 KB,图片类型: 6","hasAlpha":true,"type":6,"width":344,"height":344,"size":33} | ||
|
||
## 返回参数说明 | ||
|
||
### hasAlpha | ||
|
||
图片是否有透明度,是否有渐变效果 | ||
|
||
### width & height | ||
|
||
图片的宽和高的像素数值 | ||
|
||
### size | ||
|
||
图片的大小 | ||
|
||
### type | ||
|
||
图片的编码方案,具体值参考官网介绍:[https://docs.oracle.com/javase/7/docs/api/java/awt/image/BufferedImage.html](https://docs.oracle.com/javase/7/docs/api/java/awt/image/BufferedImage.html),为了方便查看,个人用google翻译做了简单整理。 | ||
|
||
- `TYPE_CUSTOM` = 0 | ||
|
||
图像类型无法识别,因此它必须是自定义图像。 | ||
|
||
- `TYPE_INT_RGB` = 1 | ||
|
||
表示具有8位RGB颜色分量的整数像素的图像,他没有alpha值。 | ||
|
||
- `TYPE_INT_ARGB` = 2 | ||
|
||
表示具有8位RGBA颜色成分的整数像素的图像,她有alpha值。 | ||
|
||
- `TYPE_INT_ARGB_PRE` = 3 | ||
|
||
表示具有8位RGBA颜色成分的整数像素的图像。 | ||
|
||
- `TYPE_INT_BGR` = 4 | ||
|
||
表示具有8位RGB颜色分量的图像,对应于Windows或Solaris样式的BGR颜色模型,蓝色,绿色和红色颜色打包成整数像素。 | ||
- `TYPE_3BYTE_BGR` = 5 | ||
|
||
表示具有8位RGB颜色分量的图像,对应于Windows风格的BGR颜色模型,蓝色,绿色和红色以3个字节存储。 | ||
|
||
- `TYPE_4BYTE_ABGR` = 6 | ||
|
||
表示具有蓝色,绿色和红色的8位RGBA颜色分量的图像,存储在3个字节和1个字节的alpha中。 | ||
|
||
- `TYPE_4BYTE_ABGR_PRE` = 7 | ||
|
||
表示具有蓝色,绿色和红色的8位RGBA颜色分量的图像,存储在3个字节和1个字节的alpha中。 | ||
|
||
- `TYPE_USHORT_565_RGB` = 8 | ||
|
||
表示具有5-6-5 RGB颜色分量(5位红色,6位绿色,5位蓝色),无alpha的图像。 | ||
|
||
- `TYPE_USHORT_555_RGB` = 9 | ||
|
||
表示5-5-5 RGB颜色分量(5位红色,5位绿色,5位蓝色)的图像,无alpha。 | ||
|
||
- `TYPE_BYTE_GRAY` = 10 | ||
|
||
表示无符号字节灰度图像,无索引。 | ||
|
||
- `TYPE_USHORT_GRAY` = 11 | ||
|
||
表示无符号短灰度图像,非索引)。 | ||
|
||
- `TYPE_BYTE_BINARY` = 12 | ||
|
||
表示不透明的字节打包的1,2或4位图像。 | ||
|
||
- `TYPE_BYTE_INDEXED` = 13 | ||
|
||
表示索引的字节图像。 | ||
|
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
package com.bihe0832.photo; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Arrays; | ||
import java.util.HashMap; | ||
|
||
public class PhotoInfo { | ||
|
||
private static final String MAKE = "Make"; | ||
private static final String MODEL = "Model"; | ||
private static final String DATE_TIME_ORIGINAL = "Date/Time Original"; | ||
private static final String DATE_STAMP = "GPS Date Stamp"; | ||
private static final String TIME_STAMP = "GPS Time-Stamp"; | ||
private static final String WIDTH = "Image Width"; | ||
private static final String HEIGHT = "Image Height"; | ||
private static final String LATITUDE_REF = "GPS Latitude Ref"; | ||
private static final String LATITUDE_VALUE = "GPS Latitude"; | ||
private static final String LONGTITUDE_REF = "GPS Longitude Ref"; | ||
private static final String LONGTITUDE_VALUE = "GPS Longitude"; | ||
private static final String ALTITUDE_REF = "GPS Altitude Ref"; | ||
private static final String ALTITUDE_VALUE = "GPS Altitude"; | ||
|
||
public HashMap<String, String> valueList = new HashMap<String, String>(); | ||
|
||
public static final ArrayList<String> keyList = new ArrayList<String>( | ||
Arrays.asList(MAKE, MODEL, DATE_TIME_ORIGINAL, DATE_STAMP, TIME_STAMP, WIDTH, HEIGHT, | ||
LATITUDE_REF, LONGTITUDE_REF, LATITUDE_VALUE, LONGTITUDE_VALUE,ALTITUDE_REF,ALTITUDE_VALUE)); | ||
|
||
private String getValueByKey(String key) { | ||
if(valueList.containsKey(key)){ | ||
String value = valueList.get(key); | ||
return value.trim(); | ||
}else{ | ||
return ""; | ||
} | ||
} | ||
|
||
public String getMake() { | ||
return getValueByKey(MAKE); | ||
} | ||
public String getModel() { | ||
return getValueByKey(MODEL); | ||
} | ||
public String getDateTimeOriginal() { | ||
return getValueByKey( DATE_TIME_ORIGINAL); | ||
} | ||
public String getDateTimeStamp() { | ||
return getValueByKey(DATE_STAMP) + " " + getValueByKey(TIME_STAMP); | ||
} | ||
public String getWidth() { | ||
return getValueByKey( WIDTH); | ||
} | ||
public String getHeight() { | ||
return getValueByKey( HEIGHT); | ||
} | ||
public String getLatitudeRef() { | ||
return getValueByKey(LATITUDE_REF); | ||
} | ||
|
||
public String getLatitudeValue() { | ||
return getValueByKey( LATITUDE_VALUE); | ||
} | ||
public String getLatitude() { | ||
return getLatitudeValue() + " " + getLatitudeRef(); | ||
} | ||
|
||
public String getLongitudeRef() { | ||
return getValueByKey( LONGTITUDE_REF); | ||
} | ||
|
||
public String getLongitudeValue() { | ||
return getValueByKey( LONGTITUDE_VALUE); | ||
} | ||
|
||
public String getLongitude() { | ||
return getLongitudeValue() + " " + getLongitudeRef(); | ||
} | ||
public String getAltitudeRef() { | ||
return getValueByKey( ALTITUDE_REF); | ||
} | ||
|
||
public String getAltitudeValue() { | ||
return getValueByKey( ALTITUDE_VALUE); | ||
} | ||
|
||
public String getAltitude() { | ||
return getAltitudeRef() + ":" + getAltitudeValue() ; | ||
} | ||
} |
Oops, something went wrong.