java 读取JPEG图像的Exif信息

注意:所有类型图像文件中,只有JPEG具有Exif信息

1public class JpegDecodeTest { 2 3 4 public static byte[] getJPEGBytes(String filename) 5 { 6 FileInputStream fis = null; 7 try { 8 fis = new FileInputStream(filename); 9 int available = fis.available(); 10 ByteArrayOutputStream baos = new ByteArrayOutputStream(available); 11 int len = -1; 12 byte[] buf = new byte[1028]; 13 while ((len=fis.read(buf, 0, buf.length))!=-1) 14 { 15 baos.write(buf, 0, len); 16 } 17 return baos.toByteArray(); 18 } catch (FileNotFoundException e) { 19 e.printStackTrace(); 20 } catch (IOException e) { 21 e.printStackTrace(); 22 }finally{ 23 if(fis!=null) 24 { 25 try { 26 fis.close(); 27 } catch (IOException e) { 28 } 29 } 30 } 31 return null; 32 } 33 public static void main(String[] args) throws JSONException, IOException { 34 35 byte[] buf = getJPEGBytes("ttt.png"); 36 for (int i = 0; i < buf.length; i++) 37 { 38 int b = buf[i]&0xff; 39 if(i>0 &&buf[i-1]==-1) 40 { 41 String s = null; 42 switch (b) { 43 case 0xD8: 44 s = "SOI"; 45 break; 46 case 0xDB: 47 s = "DQT"; 48 showJPEGDHQ(buf,i); 49 break; 50 case 0xE0: 51 { 52 s = "APP0"; 53 showJPEGApp0(buf,i); 54 } 55 break; 56 case 0xC0: 57 s = "SOF0"; 58 showJPEGSOF0(buf,i); 59 break; 60 case 0xC4: 61 s = "DHT"; 62 break; 63 case 0xDD: 64 s = "DRI"; 65 break; 66 case 0xDA: 67 s = "SOS"; 68 break; 69 case 0xD9: 70 s = "EOI"; 71 break; 72 73 default: 74 { 75 int H = (int)(b&0xff); 76 if(H>=0xE1 && 0xEF>=H) 77 { 78 s = "APPE"+(H-225+1); 79 showJPEGAppH(buf, i); 80 } 81 } 82 break; 83 } 84 if(s!=null) 85 { 86 System.out.println(" FIND-Flag: "+s); 87 } 88 } 89 } 90 91 } 92 private static void showJPEGDHQ(byte[] buf, int i) 93 { 94 95 if(buf==null || buf.length<=i) 96 { 97 return; 98 } 99 int startIndex = i+1; 100 int len = getByteToInteger(buf, startIndex, 2, true); 101 System.out.println("DHQ长度:"+len); 102 } 103 private static void showJPEGSOF0(byte[] buf, int i) 104 { 105 if(buf==null || buf.length<=i) 106 { 107 return; 108 } 109 int startIndex = i+1; 110 int len = getByteToInteger(buf, startIndex, 2, true); 111 System.out.println("App0长度:"+len); 112 byte[] sof0Buf = new byte[len]; 113 System.arraycopy(buf, startIndex, sof0Buf, 0, len); 114 startIndex = 0; 115 startIndex = startIndex + 2; 116 117 int degree = sof0Buf[startIndex]&0XFF; //精度 118 int width = getByteToInteger(sof0Buf, startIndex+1, 2, true); 119 int height = getByteToInteger(sof0Buf, startIndex+3, 2, true); 120 int xyDelta = sof0Buf[startIndex+5]&0XFF; //颜色分量 121 startIndex = startIndex + 6; 122 int restLen = len - startIndex; 123 124 125 } 126 private static void showJPEGApp0(byte[] buf, int i) 127 { 128 129 if(buf==null || buf.length<=i) 130 { 131 return; 132 } 133 int startIndex = i+1; 134 int len = getByteToInteger(buf, startIndex, 2, true); 135 System.out.println("App0长度:"+len); 136 137 startIndex = startIndex +2; 138 String flag = getStrings(buf, startIndex, 5).trim(); 139 System.out.println("flag:"+flag); 140 141 if("JFIF".equalsIgnoreCase(flag)) 142 { 143 startIndex = startIndex+5; 144 String version = (buf[startIndex]&0xFF) +"."+(buf[startIndex+1]&0xFF); 145 System.out.println("version="+version); 146 147 startIndex = startIndex +2; 148 int densityUnit = buf[startIndex]&0xFF; //像素单位 149 150 int XDensity = getByteToInteger(buf, startIndex+1, 2, true); 151 int YDensity = getByteToInteger(buf, startIndex+3, 2, true); 152 153 startIndex = startIndex +5; 154 String XYPixesBlockNumbers = (buf[startIndex]&0xFF) +"/"+(buf[startIndex+1]&0xFF); 155 startIndex = startIndex +2; 156 157 System.out.println("densityUnit="+densityUnit+", XDensity="+XDensity+", YDensity="+YDensity+", XYPixesBlockNumbers="+XYPixesBlockNumbers); 158 int rest = len - (startIndex-i-1); 159 if("0/0".equals(XYPixesBlockNumbers) || rest==0) 160 { 161 System.out.println("没有缩略图位图!"); 162 }else{ 163 byte[] bmpBytes = new byte[rest]; 164 System.arraycopy(buf, startIndex, bmpBytes, 0, rest); 165 System.out.println("RGB位图大小:"+bmpBytes.length); 166 } 167 168 } 169 170 } 171 private static void showJPEGAppH(byte[] buf, int i) throws IOException 172 { 173 174 if(buf==null || buf.length<=i) 175 { 176 return; 177 } 178 int len = getByteToInteger(buf, i+1, 2, true); 179 System.out.println("本段长度:"+len); 180 181 byte[] appbuf = new byte[len]; 182 System.arraycopy(buf, i+1, appbuf, 0, len); 183 184 int k = 2; 185 186 String strIfExif = getStrings(appbuf, k, 4); 187 if("Exif".equalsIgnoreCase(strIfExif)) 188 { 189 int iTIFFOffset = k + 4; 190 //大小端保存问题,占4个字节 191 int bytesToInt = getByteToInteger(appbuf, iTIFFOffset, 4, true); 192 boolean isBigEndian = false; 193 if(bytesToInt==0x4949) 194 { //小端模式 195 isBigEndian = false; 196 }else if(bytesToInt==0x4D4D){ //大端模式 197 isBigEndian = true; 198 }else{ 199 System.out.println("Not valid TIFF data! (no 0x4949 or 0x4D4D)"); 200 return; 201 } 202 203 if(isBigEndian) 204 { 205 System.out.println("大端模式"); 206 207 iTIFFOffset = iTIFFOffset + 4; 208 int checkNumber = getByteToInteger(appbuf, iTIFFOffset, 2, isBigEndian); 209 System.out.println("checkNumber="+checkNumber); 210 boolean isValidExif = true; 211 if(checkNumber!=0x002A){ 212 isValidExif = false; 213 System.out.println("Not valid TIFF data! (no 0x002A)"); 214 return; 215 } 216 iTIFFOffset = iTIFFOffset + 2; 217 checkNumber = getByteToInteger(appbuf, iTIFFOffset, 4,isBigEndian); 218 System.out.println("checkNumber="+checkNumber); 219 220 if (checkNumber!= 0x0008) 221 { 222 isValidExif = false; 223 System.out.println("Not valid TIFF data! (First offset not 8)"); 224 return; 225 } 226 227 Map<String, Object> map = readTagInfo(Exif.TiffTags.class, appbuf, iTIFFOffset,iTIFFOffset+4, isBigEndian); 228 if(map.containsKey("ExifIFDPointer")) 229 { 230 int ExifIFDPointerOffset = (int) map.get("ExifIFDPointer")+iTIFFOffset-4; 231 System.out.println(ExifIFDPointerOffset); 232 Map<String, Object> readTagInfo = readTagInfo(Exif.Tags.class, appbuf, iTIFFOffset,ExifIFDPointerOffset, isBigEndian); 233 map.putAll(readTagInfo); 234 } 235 236 if (map.containsKey("GPSInfoIFDPointer")) { 237 int GPSInfoIFDPointer = (int) map.get("GPSInfoIFDPointer")+iTIFFOffset-4; 238 System.out.println(GPSInfoIFDPointer); 239 Map<String, Object> readTagInfo = readTagInfo(Exif.GPSTags.class, appbuf, iTIFFOffset,GPSInfoIFDPointer, isBigEndian); 240 map.putAll(readTagInfo); 241 } 242 243 System.out.println(map); 244 }else{ 245 System.out.println("小端模式"); 246 } 247 248 }else{ 249 strIfExif = new String(buf, i,len); 250 System.out.println(strIfExif); 251 } 252 } 253 private static Map<String, Object> readTagInfo(Class clazz, byte[] appbuf, int iTIFFOffset,int startDir, boolean isBigEndian) { 254 int iEntries = getByteToInteger(appbuf, startDir, 2, isBigEndian); 255 Map<String, Object> map = new HashMap<String, Object>(); 256 for (int t=0;t<iEntries;t++) 257 { 258 int iEntryOffset = (startDir+2) + t*12; //每个报文段长度是12 259 260 int iType = getByteToInteger(appbuf, iEntryOffset+2, 2, isBigEndian); 261 int iNumValues = getByteToInteger(appbuf, iEntryOffset+4, 4, isBigEndian); 262 //计算数据的偏移位置 263 int iValueOffset = getByteToInteger(appbuf, iEntryOffset+8, 4, isBigEndian)+iTIFFOffset-4; 264 265 String strTag = readTag(clazz,getByteToInteger(appbuf, iEntryOffset, 2, isBigEndian),isBigEndian); 266 Object values = readTagValue(appbuf,iType,iValueOffset,iNumValues,iEntryOffset); 267 System.err.println(strTag+"["+iType+","+iNumValues+","+iValueOffset+"] ="+values); 268 map.put(strTag, values); 269 } 270 return map; 271 } 272 273 private static Object readTagValue(byte[] appbuf, int iType, int iValueOffset,int iNumValues,int iEntryOffset) { 274 275 Object value = null; 276 switch (iType) { 277 case 1: 278 case 7: 279 { 280 if (iNumValues == 1) { 281 value = appbuf[iEntryOffset + 8]; 282 } else { 283 int iValOffset = iNumValues > 4 ? iValueOffset : (iEntryOffset + 8); 284 String[] aVals = new String[iNumValues]; 285 for (int n=0;n<iNumValues;n++) { 286 aVals[n] = appbuf[iValOffset + n]+""; 287 } 288 value = Arrays.asList(aVals); 289 } 290 } 291 break; 292 case 2: 293 int iStringOffset = iNumValues>4?iValueOffset : (iEntryOffset + 8); 294 value = getStrings(appbuf,iStringOffset,iNumValues-1); 295 break; 296 case 3: 297 { 298 if (iNumValues == 1) { 299 value = getByteToInteger(appbuf, iEntryOffset+8, 4, true); 300 } else if(iNumValues >= 2){ 301 int iValOffset = iNumValues > 2 ? iValueOffset : (iEntryOffset + 8); 302 String[] aVals = new String[iNumValues]; 303 for (int n=0;n<iNumValues;n++) { 304 aVals[n] =getByteToInteger(appbuf, iValueOffset + 2*n, 4, true)+""; 305 } 306 value = Arrays.asList(aVals); 307 } 308 } 309 break; 310 case 4: 311 { 312 if (iNumValues == 1) { 313 value = getByteToInteger(appbuf, iEntryOffset+8, 4, true); 314 } else { 315 String[] aVals = new String[iNumValues]; 316 for (int n=0;n<iNumValues;n++) { 317 aVals[n] =getByteToInteger(appbuf, iValueOffset + 4*n, 4, true)+""; 318 } 319 value = Arrays.asList(aVals); 320 } 321 } 322 break; 323 case 5: 324 { 325 if (iNumValues == 1) { 326 value = ""+getByteToInteger(appbuf, iValueOffset, 4, true)+"/"+getByteToInteger(appbuf, iValueOffset+4, 4, true); 327 } else { 328 String[] values = new String[iNumValues]; 329 for (int n=0;n<iNumValues;n++) { 330 values[n] = getByteToInteger(appbuf, iValueOffset+8*n, 4, true) +"/"+ getByteToInteger(appbuf, iValueOffset+4+8*n, 4, true); 331 } 332 value = Arrays.asList(values); 333 } 334 } 335 break; 336 case 9: 337 338 break; 339 case 10: 340 { 341 if (iNumValues == 1) { 342 value = getByteToInteger(appbuf, iValueOffset, 4, true) +"/"+getByteToInteger(appbuf, iValueOffset+4, 4, true); 343 } else { 344 String[] aVals = new String[iNumValues]; 345 for (int n=0;n<iNumValues;n++) { 346 aVals[n] = ""+getByteToInteger(appbuf,iValueOffset + 8*n,4, true) +"/"+ getByteToInteger(appbuf,iValueOffset+4 + 8*n,4, true); 347 } 348 value = Arrays.asList(aVals); 349 } 350 } 351 break; 352 default: 353 System.err.println("Invalid range ["+iType+","+iNumValues+","+iValueOffset+"]"); 354 break; 355 } 356 357 return value; 358 } 359 private static String readTag(Class clazz,int id,boolean isBigEndian) 360 { 361 Field[] fields = clazz.getDeclaredFields(); 362 try { 363 for (Field field : fields) { 364 field.setAccessible(true); 365 if(!Modifier.isStatic(field.getModifiers())) 366 { 367 continue; 368 } 369 Tag tag = (Tag) field.get(clazz); 370 if(tag.getId()==id) 371 { 372 return tag.getName(); 373 } 374 } 375 } catch (SecurityException e) { 376 e.printStackTrace(); 377 } catch (IllegalArgumentException e) { 378 e.printStackTrace(); 379 } catch (IllegalAccessException e) { 380 e.printStackTrace(); 381 } 382 return null; 383 } 384 private static String getStrings( byte[] bs) 385 { 386 return new String(bs, 0,bs.length); 387 } 388 389 private static String getStrings( byte[] bs,int start,int length) 390 { 391 return new String(bs, start,length); 392 } 393 394 private static int getByteToInteger(byte[] bs,int start,int length,boolean isBigEndian) 395 { 396 byte[] tmpBuf = new byte[]{0,0,0,0}; 397 if(length==2) 398 { 399 tmpBuf[2] = bs[start]; 400 tmpBuf[3] = bs[start+1]; 401 }else if(length==4){ 402 tmpBuf[0] = bs[start]; 403 tmpBuf[1] = bs[start+1]; 404 tmpBuf[2] = bs[start+2]; 405 tmpBuf[3] = bs[start+3]; 406 } 407 408 return isBigEndian?bytesToInt(tmpBuf):bytesToIntLitterEndian(tmpBuf); 409 } 410 411 /** 412 * 大端模式 413 * @param src 414 * @return 415 */ 416 public static int bytesToInt(byte[] src) { 417 int value; 418 int offset = 0; 419 value = (int) ( ((src[offset] & 0xFF)<<24) 420 |((src[offset+1] & 0xFF)<<16) 421 |((src[offset+2] & 0xFF)<<8) 422 |(src[offset+3] & 0xFF)); 423 return value; 424 } 425 /** 426 * 小端模式 427 * @param src 428 * @return 429 */ 430 public static int bytesToIntLitterEndian(byte[] src) { 431 int value; 432 int offset = 0; 433 value = (int) ( ((src[offset+3] & 0xFF)<<24) 434 |((src[offset+2] & 0xFF)<<16) 435 |((src[offset+1] & 0xFF)<<8) 436 |(src[offset] & 0xFF)); 437 return value; 438 } 439}

辅助类

1package com.uap.test; 2 3import java.io.*; 4 5public class Exif { 6 7 public static Tag createTag(int id, String name) { 8 return new Tag(id, name); 9 } 10 11 public interface Tags { 12 13 public static final Tag Tag_ExifVersion = Exif.createTag(0x9000, "ExifVersion"); 14 15 // EXIFversion 16 public static final Tag Tag_FlashpixVersion = Exif.createTag(0xA000, "FlashpixVersion"); 17 18 // Flashpixformatversion 19 public static final Tag Tag_ColorSpace = Exif.createTag(0xA001, "ColorSpace"); 20 21 // Colorspaceinformationtag 22 public static final Tag Tag_PixelXDimension = Exif.createTag(0xA002, "PixelXDimension"); 23 24 // Validwidthofmeaningfulimage 25 public static final Tag Tag_PixelYDimension = Exif.createTag(0xA003, "PixelYDimension"); 26 27 // Validheightofmeaningfulimage 28 public static final Tag Tag_ComponentsConfiguration = Exif.createTag(0x9101, "ComponentsConfiguration"); 29 30 // Informationaboutchannels 31 public static final Tag Tag_CompressedBitsPerPixel = Exif.createTag(0x9102, "CompressedBitsPerPixel"); 32 33 // Compressedbitsperpixel 34 35 public static final Tag Tag_MakerNote = Exif.createTag(0x927C, "MakerNote"); 36 37 // Anydesiredinformationwrittenbythemanufacturer 38 public static final Tag Tag_UserComment = Exif.createTag(0x9286, "UserComment"); 39 40 // Commentsbyuser 41 public static final Tag Tag_RelatedSoundFile = Exif.createTag(0xA004, "RelatedSoundFile"); 42 43 // Nameofrelatedsoundfile 44 public static final Tag Tag_DateTimeOriginal = Exif.createTag(0x9003, "DateTimeOriginal"); 45 46 // Dateandtimewhentheoriginalimagewasgenerated 47 48 public static final Tag Tag_DateTimeDigitized = Exif.createTag(0x9004, "DateTimeDigitized"); 49 50 // Dateandtimewhentheimagewasstoreddigitally 51 52 public static final Tag Tag_SubsecTime = Exif.createTag(0x9290, "SubsecTime"); 53 54 // FractionsofsecondsforDateTime 55 56 public static final Tag Tag_SubsecTimeOriginal = Exif.createTag(0x9291, "SubsecTimeOriginal"); 57 58 // FractionsofsecondsforDateTimeOriginal 59 60 public static final Tag Tag_SubsecTimeDigitized = Exif.createTag(0x9292, "SubsecTimeDigitized"); 61 62 // FractionsofsecondsforDateTimeDigitized 63 64 public static final Tag Tag_ExposureTime = Exif.createTag(0x829A, "ExposureTime"); 65 66 // Exposuretime(inseconds) 67 68 public static final Tag Tag_FNumber = Exif.createTag(0x829D, "FNumber"); 69 70 // Fnumber 71 72 public static final Tag Tag_ExposureProgram = Exif.createTag(0x8822, "ExposureProgram"); 73 74 // Exposureprogram 75 76 public static final Tag Tag_SpectralSensitivity = Exif.createTag(0x8824, "SpectralSensitivity"); 77 78 // Spectralsensitivity 79 80 public static final Tag Tag_ISOSpeedRatings = Exif.createTag(0x8827, "ISOSpeedRatings"); 81 82 // ISOspeedrating 83 84 public static final Tag Tag_OECF = Exif.createTag(0x8828, "OECF"); 85 86 // Optoelectricconversionfactor 87 88 public static final Tag Tag_ShutterSpeedValue = Exif.createTag(0x9201, "ShutterSpeedValue"); 89 90 // Shutterspeed 91 92 public static final Tag Tag_ApertureValue = Exif.createTag(0x9202, "ApertureValue"); 93 94 // Lensaperture 95 96 public static final Tag Tag_BrightnessValue = Exif.createTag(0x9203, "BrightnessValue"); 97 98 // Valueofbrightness 99 100 public static final Tag Tag_ExposureBias = Exif.createTag(0x9204, "ExposureBias"); 101 102 // Exposurebias 103 104 public static final Tag Tag_MaxApertureValue = Exif.createTag(0x9205, "MaxApertureValue"); 105 106 // SmallestFnumberoflens 107 108 public static final Tag Tag_SubjectDistance = Exif.createTag(0x9206, "SubjectDistance"); 109 110 // Distancetosubjectinmeters 111 112 public static final Tag Tag_MeteringMode = Exif.createTag(0x9207, "MeteringMode"); 113 114 // Meteringmode 115 116 public static final Tag Tag_LightSource = Exif.createTag(0x9208, "LightSource"); 117 118 // Kindoflightsource 119 120 public static final Tag Tag_Flash = Exif.createTag(0x9209, "Flash"); 121 122 // Flashstatus 123 124 public static final Tag Tag_SubjectArea = Exif.createTag(0x9214, "SubjectArea"); 125 126 // Locationandareaofmainsubject 127 128 public static final Tag Tag_FocalLength = Exif.createTag(0x920A, "FocalLength"); 129 130 // Focallengthofthelensinmm 131 132 public static final Tag Tag_FlashEnergy = Exif.createTag(0xA20B, "FlashEnergy"); 133 134 // StrobeenergyinBCPS 135 136 public static final Tag Tag_SpatialFrequencyResponse = Exif.createTag(0xA20C, "SpatialFrequencyResponse"); 137 138 public static final Tag Tag_FocalPlaneXResolution = Exif.createTag(0xA20E, "FocalPlaneXResolution"); 139 140 // NumberofpixelsinwidthdirectionperFocalPlaneResolutionUnit 141 142 public static final Tag Tag_FocalPlaneYResolution = Exif.createTag(0xA20F, "FocalPlaneYResolution"); 143 144 // NumberofpixelsinheightdirectionperFocalPlaneResolutionUnit 145 146 public static final Tag Tag_FocalPlaneResolutionUnit = Exif.createTag(0xA210, "FocalPlaneResolutionUnit"); 147 148 // UnitformeasuringFocalPlaneXResolutionandFocalPlaneYResolution 149 150 public static final Tag Tag_SubjectLocation = Exif.createTag(0xA214, "SubjectLocation"); 151 152 // Locationofsubjectinimage 153 154 public static final Tag Tag_ExposureIndex = Exif.createTag(0xA215, "ExposureIndex"); 155 156 // Exposureindexselectedoncamera 157 158 public static final Tag Tag_SensingMethod = Exif.createTag(0xA217, "SensingMethod"); 159 160 // Imagesensortype 161 162 public static final Tag Tag_FileSource = Exif.createTag(0xA300, "FileSource"); 163 164 // Imagesource(3DSC) 165 166 public static final Tag Tag_SceneType = Exif.createTag(0xA301, "SceneType"); 167 168 // Scenetype(1directlyphotographed) 169 170 public static final Tag Tag_CFAPattern = Exif.createTag(0xA302, "CFAPattern"); 171 172 // Colorfilterarraygeometricpattern 173 174 public static final Tag Tag_CustomRendered = Exif.createTag(0xA401, "CustomRendered"); 175 176 // Specialprocessing 177 178 public static final Tag Tag_ExposureMode = Exif.createTag(0xA402, "ExposureMode"); 179 180 // Exposuremode 181 182 public static final Tag Tag_WhiteBalance = Exif.createTag(0xA403, "WhiteBalance"); 183 184 // 1autowhitebalance,2manual 185 186 public static final Tag Tag_DigitalZoomRation = Exif.createTag(0xA404, "DigitalZoomRation"); 187 188 // Digitalzoomratio 189 190 public static final Tag Tag_FocalLengthIn35mmFilm = Exif.createTag(0xA405, "FocalLengthIn35mmFilm"); 191 192 // Equivalentfoacllengthassuming35mmfilmcamera(inmm) 193 194 public static final Tag Tag_SceneCaptureType = Exif.createTag(0xA406, "SceneCaptureType"); 195 196 // Typeofscene 197 198 public static final Tag Tag_GainControl = Exif.createTag(0xA407, "GainControl"); 199 200 // Degreeofoverallimagegainadjustment 201 202 public static final Tag Tag_Contrast = Exif.createTag(0xA408, "Contrast"); 203 204 // Directionofcontrastprocessingappliedbycamera 205 206 public static final Tag Tag_Saturation = Exif.createTag(0xA409, "Saturation"); 207 208 // Directionofsaturationprocessingappliedbycamera 209 210 public static final Tag Tag_Sharpness = Exif.createTag(0xA40A, "Sharpness"); 211 212 // Directionofsharpnessprocessingappliedbycamera 213 214 public static final Tag Tag_DeviceSettingDescription = Exif.createTag(0xA40B, "DeviceSettingDescription"); 215 216 public static final Tag Tag_SubjectDistanceRange = Exif.createTag(0xA40C, "SubjectDistanceRange"); 217 218 // Distancetosubject 219 220 public static final Tag Tag_InteroperabilityIFDPointer = Exif.createTag(0xA005, "InteroperabilityIFDPointer"); 221 222 public static final Tag Tag_ImageUniqueID = Exif.createTag(0xA420, "ImageUniqueID"); 223 224 // Identifierassigneduniquelytoeachimage 225 226 } 227 228 public interface TiffTags { 229 230 public static final Tag Tag_ImageWidth = Exif.createTag(0x0100, "ImageWidth"); 231 232 public static final Tag Tag_ImageHeight = Exif.createTag(0x0101, "ImageHeight"); 233 234 public static final Tag Tag_ExifIFDPointer = Exif.createTag(0x8769, "ExifIFDPointer"); 235 236 public static final Tag Tag_GPSInfoIFDPointer = Exif.createTag(0x8825, "GPSInfoIFDPointer"); 237 238 public static final Tag Tag_InteroperabilityIFDPointer = Exif.createTag(0xA005, "InteroperabilityIFDPointer"); 239 240 public static final Tag Tag_BitsPerSample = Exif.createTag(0x0102, "BitsPerSample"); 241 242 public static final Tag Tag_Compression = Exif.createTag(0x0103, "Compression"); 243 244 public static final Tag Tag_PhotometricInterpretation = Exif.createTag(0x0106, "PhotometricInterpretation"); 245 246 public static final Tag Tag_Orientation = Exif.createTag(0x0112, "Orientation"); 247 248 public static final Tag Tag_SamplesPerPixel = Exif.createTag(0x0115, "SamplesPerPixel"); 249 250 public static final Tag Tag_PlanarConfiguration = Exif.createTag(0x011C, "PlanarConfiguration"); 251 252 public static final Tag Tag_YCbCrSubSampling = Exif.createTag(0x0212, "YCbCrSubSampling"); 253 254 public static final Tag Tag_YCbCrPositioning = Exif.createTag(0x0213, "YCbCrPositioning"); 255 256 public static final Tag Tag_XResolution = Exif.createTag(0x011A, "XResolution"); 257 258 public static final Tag Tag_YResolution = Exif.createTag(0x011B, "YResolution"); 259 260 public static final Tag Tag_ResolutionUnit = Exif.createTag(0x0128, "ResolutionUnit"); 261 262 public static final Tag Tag_StripOffsets = Exif.createTag(0x0111, "StripOffsets"); 263 264 public static final Tag Tag_RowsPerStrip = Exif.createTag(0x0116, "RowsPerStrip"); 265 266 public static final Tag Tag_StripByteCounts = Exif.createTag(0x0117, "StripByteCounts"); 267 268 public static final Tag Tag_JPEGInterchangeFormat = Exif.createTag(0x0201, "JPEGInterchangeFormat"); 269 270 public static final Tag Tag_JPEGInterchangeFormatLength = Exif.createTag(0x0202, "JPEGInterchangeFormatLength"); 271 272 public static final Tag Tag_TransferFunction = Exif.createTag(0x012D, "TransferFunction"); 273 274 public static final Tag Tag_WhitePoint = Exif.createTag(0x013E, "WhitePoint"); 275 276 public static final Tag Tag_PrimaryChromaticities = Exif.createTag(0x013F, "PrimaryChromaticities"); 277 278 public static final Tag Tag_YCbCrCoefficients = Exif.createTag(0x0211, "YCbCrCoefficients"); 279 280 public static final Tag Tag_ReferenceBlackWhite = Exif.createTag(0x0214, "ReferenceBlackWhite"); 281 282 public static final Tag Tag_DateTime = Exif.createTag(0x0132, "DateTime"); 283 284 public static final Tag Tag_ImageDescription = Exif.createTag(0x010E, "ImageDescription"); 285 286 public static final Tag Tag_Make = Exif.createTag(0x010F, "Make"); 287 288 public static final Tag Tag_Model = Exif.createTag(0x0110, "Model"); 289 290 public static final Tag Tag_Software = Exif.createTag(0x0131, "Software"); 291 292 public static final Tag Tag_Artist = Exif.createTag(0x013B, "Artist"); 293 294 public static final Tag Tag_Copyright = Exif.createTag(0x8298, "Copyright"); 295 296 } 297 298 public interface GPSTags { 299 300 public static final Tag Tag_GPSVersionID = Exif.createTag(0x0000, "GPSVersionID"); 301 302 public static final Tag Tag_GPSLatitudeRef = Exif.createTag(0x0001, "GPSLatitudeRef"); 303 304 public static final Tag Tag_GPSLatitude = Exif.createTag(0x0002, "GPSLatitude"); 305 306 public static final Tag Tag_GPSLongitudeRef = Exif.createTag(0x0003, "GPSLongitudeRef"); 307 308 public static final Tag Tag_GPSLongitude = Exif.createTag(0x0004, "GPSLongitude"); 309 310 public static final Tag Tag_GPSAltitudeRef = Exif.createTag(0x0005, "GPSAltitudeRef"); 311 312 public static final Tag Tag_GPSAltitude = Exif.createTag(0x0006, "GPSAltitude"); 313 314 public static final Tag Tag_GPSTimeStamp = Exif.createTag(0x0007, "GPSTimeStamp"); 315 316 public static final Tag Tag_GPSSatellites = Exif.createTag(0x0008, "GPSSatellites"); 317 318 public static final Tag Tag_GPSStatus = Exif.createTag(0x0009, "GPSStatus"); 319 320 public static final Tag Tag_GPSMeasureMode = Exif.createTag(0x000A, "GPSMeasureMode"); 321 322 public static final Tag Tag_GPSDOP = Exif.createTag(0x000B, "GPSDOP"); 323 324 public static final Tag Tag_GPSSpeedRef = Exif.createTag(0x000C, "GPSSpeedRef"); 325 326 public static final Tag Tag_GPSSpeed = Exif.createTag(0x000D, "GPSSpeed"); 327 328 public static final Tag Tag_GPSTrackRef = Exif.createTag(0x000E, "GPSTrackRef"); 329 330 public static final Tag Tag_GPSTrack = Exif.createTag(0x000F, "GPSTrack"); 331 332 public static final Tag Tag_GPSImgDirectionRef = Exif.createTag(0x0010, "GPSImgDirectionRef"); 333 334 public static final Tag Tag_GPSImgDirection = Exif.createTag(0x0011, "GPSImgDirection"); 335 336 public static final Tag Tag_GPSMapDatum = Exif.createTag(0x0012, "GPSMapDatum"); 337 338 public static final Tag Tag_GPSDestLatitudeRef = Exif.createTag(0x0013, "GPSDestLatitudeRef"); 339 340 public static final Tag Tag_GPSDestLatitude = Exif.createTag(0x0014, "GPSDestLatitude"); 341 342 public static final Tag Tag_GPSDestLongitudeRef = Exif.createTag(0x0015, "GPSDestLongitudeRef"); 343 344 public static final Tag Tag_GPSDestLongitude = Exif.createTag(0x0016, "GPSDestLongitude"); 345 346 public static final Tag Tag_GPSDestBearingRef = Exif.createTag(0x0017, "GPSDestBearingRef"); 347 348 public static final Tag Tag_GPSDestBearing = Exif.createTag(0x0018, "GPSDestBearing"); 349 350 public static final Tag Tag_GPSDestDistanceRef = Exif.createTag(0x0019, "GPSDestDistanceRef"); 351 352 public static final Tag Tag_GPSDestDistance = Exif.createTag(0x001A, "GPSDestDistance"); 353 354 public static final Tag Tag_GPSProcessingMethod = Exif.createTag(0x001B, "GPSProcessingMethod"); 355 356 public static final Tag Tag_GPSAreaInformation = Exif.createTag(0x001C, "GPSAreaInformation"); 357 358 public static final Tag Tag_GPSDateStamp = Exif.createTag(0x001D, "GPSDateStamp"); 359 360 public static final Tag Tag_GPSDifferential = Exif.createTag(0x001E, "GPSDifferential"); 361 362 } 363 364 public interface StringValues { 365 366 public interface ExposureProgram { 367 368 public static final Tag Tag_Notdefined = Exif.createTag(0, "Notdefined"); 369 370 public static final Tag Tag_Manual = Exif.createTag(1, "Manual"); 371 372 public static final Tag Tag_Normalprogram = Exif.createTag(2, "Normalprogram"); 373 374 public static final Tag Tag_Aperturepriority = Exif.createTag(3, "Aperturepriority"); 375 376 public static final Tag Tag_Shutterpriority = Exif.createTag(4, "Shutterpriority"); 377 378 public static final Tag Tag_Creativeprogram = Exif.createTag(5, "Creativeprogram"); 379 380 public static final Tag Tag_Actionprogram = Exif.createTag(6, "Actionprogram"); 381 382 public static final Tag Tag_Portraitmode = Exif.createTag(7, "Portraitmode"); 383 384 public static final Tag Tag_Landscapemode = Exif.createTag(8, "Landscapemode"); 385 386 } 387 388 public interface MeteringMode { 389 390 public static final Tag Tag_Unknown = Exif.createTag(0, "Unknown"); 391 392 public static final Tag Tag_Average = Exif.createTag(1, "Average"); 393 394 public static final Tag Tag_CenterWeightedAverage = Exif.createTag(2, "CenterWeightedAverage"); 395 396 public static final Tag Tag_Spot = Exif.createTag(3, "Spot"); 397 398 public static final Tag Tag_MultiSpot = Exif.createTag(4, "MultiSpot"); 399 400 public static final Tag Tag_Pattern = Exif.createTag(5, "Pattern"); 401 402 public static final Tag Tag_Partial = Exif.createTag(6, "Partial"); 403 404 public static final Tag Tag_Other = Exif.createTag(255, "Other"); 405 406 } 407 408 public interface LightSource { 409 410 public static final Tag Tag_Unknown = Exif.createTag(0, "Unknown"); 411 412 public static final Tag Tag_Daylight = Exif.createTag(1, "Daylight"); 413 414 public static final Tag Tag_Fluorescent = Exif.createTag(2, "Fluorescent"); 415 416 public static final Tag Tag_Tungstenincandescentlight = Exif.createTag(3, "Tungstenincandescentlight"); 417 418 public static final Tag Tag_Flash = Exif.createTag(4, "Flash"); 419 420 public static final Tag Tag_Fineweather = Exif.createTag(9, "Fineweather"); 421 422 public static final Tag Tag_Cloudyweather = Exif.createTag(10, "Cloudyweather"); 423 424 public static final Tag Tag_Shade = Exif.createTag(11, "Shade"); 425 426 public static final Tag Tag_DaylightfluorescentD57007100K = Exif.createTag(12, 427 "DaylightfluorescentD57007100K"); 428 429 public static final Tag Tag_DaywhitefluorescentN46005400K = Exif.createTag(13, 430 "DaywhitefluorescentN46005400K"); 431 432 public static final Tag Tag_CoolwhitefluorescentW39004500K = Exif.createTag(14, 433 "CoolwhitefluorescentW39004500K"); 434 435 public static final Tag Tag_WhitefluorescentWW32003700K = Exif.createTag(15, "WhitefluorescentWW32003700K"); 436 437 public static final Tag Tag_StandardlightA = Exif.createTag(17, "StandardlightA"); 438 439 public static final Tag Tag_StandardlightB = Exif.createTag(18, "StandardlightB"); 440 441 public static final Tag Tag_StandardlightC = Exif.createTag(19, "StandardlightC"); 442 443 public static final Tag Tag_D55 = Exif.createTag(20, "D55"); 444 445 public static final Tag Tag_D65 = Exif.createTag(21, "D65"); 446 447 public static final Tag Tag_D75 = Exif.createTag(22, "D75"); 448 449 public static final Tag Tag_D50 = Exif.createTag(23, "D50"); 450 451 public static final Tag Tag_ISOstudiotungsten = Exif.createTag(24, "ISOstudiotungsten"); 452 453 public static final Tag Tag_Other = Exif.createTag(255, "Other"); 454 455 } 456 457 public interface Flash { 458 459 public static final Tag Tag_Flashdidnotfire = Exif.createTag(0x0000, "Flashdidnotfire"); 460 461 public static final Tag Tag_Flashfired = Exif.createTag(0x0001, "Flashfired"); 462 463 public static final Tag Tag_Strobereturnlightnotdetected = Exif.createTag(0x0005, 464 "Strobereturnlightnotdetected"); 465 466 public static final Tag Tag_Strobereturnlightdetected = Exif.createTag(0x0007, "Strobereturnlightdetected"); 467 468 public static final Tag Tag_Flashfiredcompulsoryflashmode = Exif.createTag(0x0009, 469 "Flashfiredcompulsoryflashmode"); 470 471 public static final Tag Tag_Flashfiredcompulsoryflashmodereturnlightnotdetected = Exif.createTag(0x000D, 472 "Flashfiredcompulsoryflashmodereturnlightnotdetected"); 473 474 public static final Tag Tag_Flashfiredcompulsoryflashmodereturnlightdetected = Exif.createTag(0x000F, 475 "Flashfiredcompulsoryflashmodereturnlightdetected"); 476 477 public static final Tag Tag_Flashdidnotfirecompulsoryflashmode = Exif.createTag(0x0010, 478 "Flashdidnotfirecompulsoryflashmode"); 479 480 public static final Tag Tag_Flashdidnotfireautomode = Exif.createTag(0x0018, "Flashdidnotfireautomode"); 481 482 public static final Tag Tag_Flashfiredautomode = Exif.createTag(0x0019, "Flashfiredautomode"); 483 484 public static final Tag Tag_Flashfiredautomodereturnlightnotdetected = Exif.createTag(0x001D, 485 "Flashfiredautomodereturnlightnotdetected"); 486 487 public static final Tag Tag_Flashfiredautomodereturnlightdetected = Exif.createTag(0x001F, 488 "Flashfiredautomodereturnlightdetected"); 489 490 public static final Tag Tag_Noflashfunction = Exif.createTag(0x0020, "Noflashfunction"); 491 492 public static final Tag Tag_Flashfiredredeyereductionmode = Exif.createTag(0x0041, 493 "Flashfiredredeyereductionmode"); 494 495 public static final Tag Tag_Flashfiredredeyereductionmodereturnlightnotdetected = Exif.createTag(0x0045, 496 "Flashfiredredeyereductionmodereturnlightnotdetected"); 497 498 public static final Tag Tag_Flashfiredredeyereductionmodereturnlightdetected = Exif.createTag(0x0047, 499 "Flashfiredredeyereductionmodereturnlightdetected"); 500 501 public static final Tag Tag_Flashfiredcompulsoryflashmoderedeyereductionmode = Exif.createTag(0x0049, 502 "Flashfiredcompulsoryflashmoderedeyereductionmode"); 503 504 public static final Tag Tag_Flashfiredcompulsoryflashmoderedeyereductionmodereturnlightnotdetected = Exif 505 .createTag(0x004D, "Flashfiredcompulsoryflashmoderedeyereductionmodereturnlightnotdetected"); 506 507 public static final Tag Tag_Flashfiredcompulsoryflashmoderedeyereductionmodereturnlightdetected = Exif 508 .createTag(0x004F, "Flashfiredcompulsoryflashmoderedeyereductionmodereturnlightdetected"); 509 510 public static final Tag Tag_Flashfiredautomoderedeyereductionmode = Exif.createTag(0x0059, 511 "Flashfiredautomoderedeyereductionmode"); 512 513 public static final Tag Tag_Flashfiredautomodereturnlightnotdetectedredeyereductionmode = Exif 514 .createTag(0x005D, "Flashfiredautomodereturnlightnotdetectedredeyereductionmode"); 515 516 public static final Tag Tag_Flashfiredautomodereturnlightdetectedredeyereductionmode = Exif 517 .createTag(0x005F, "Flashfiredautomodereturnlightdetectedredeyereductionmode"); 518 519 } 520 521 public interface SensingMethod { 522 523 public static final Tag Tag_Notdefined = Exif.createTag(1, "Notdefined"); 524 525 public static final Tag Tag_Onechipcolorareasensor = Exif.createTag(2, "Onechipcolorareasensor"); 526 527 public static final Tag Tag_Twochipcolorareasensor = Exif.createTag(3, "Twochipcolorareasensor"); 528 529 public static final Tag Tag_Threechipcolorareasensor = Exif.createTag(4, "Threechipcolorareasensor"); 530 531 public static final Tag Tag_Colorsequentialareasensor = Exif.createTag(5, "Colorsequentialareasensor"); 532 533 public static final Tag Tag_Trilinearsensor = Exif.createTag(7, "Trilinearsensor"); 534 535 public static final Tag Tag_Colorsequentiallinearsensor = Exif.createTag(8, "Colorsequentiallinearsensor"); 536 537 } 538 539 public interface SceneCaptureType { 540 541 public static final Tag Tag_Standard = Exif.createTag(0, "Standard"); 542 543 public static final Tag Tag_Landscape = Exif.createTag(1, "Landscape"); 544 545 public static final Tag Tag_Portrait = Exif.createTag(2, "Portrait"); 546 547 public static final Tag Tag_Nightscene = Exif.createTag(3, "Nightscene"); 548 549 } 550 551 public interface SceneType { 552 553 public static final Tag Tag_Directlyphotographed = Exif.createTag(1, "Directlyphotographed"); 554 555 } 556 557 public interface CustomRendered { 558 559 public static final Tag Tag_Normalprocess = Exif.createTag(0, "Normalprocess"); 560 561 public static final Tag Tag_Customprocess = Exif.createTag(1, "Customprocess"); 562 563 } 564 565 public interface WhiteBalance { 566 567 public static final Tag Tag_Autowhitebalance = Exif.createTag(0, "Autowhitebalance"); 568 569 public static final Tag Tag_Manualwhitebalance = Exif.createTag(1, "Manualwhitebalance"); 570 571 } 572 573 public interface GainControl { 574 575 public static final Tag Tag_None = Exif.createTag(0, "None"); 576 577 public static final Tag Tag_Lowgainup = Exif.createTag(1, "Lowgainup"); 578 579 public static final Tag Tag_Highgainup = Exif.createTag(2, "Highgainup"); 580 581 public static final Tag Tag_Lowgaindown = Exif.createTag(3, "Lowgaindown"); 582 583 public static final Tag Tag_Highgaindown = Exif.createTag(4, "Highgaindown"); 584 585 } 586 587 public interface Contrast { 588 589 public static final Tag Tag_Normal = Exif.createTag(0, "Normal"); 590 591 public static final Tag Tag_Soft = Exif.createTag(1, "Soft"); 592 593 public static final Tag Tag_Hard = Exif.createTag(2, "Hard"); 594 595 } 596 597 public interface Saturation { 598 599 public static final Tag Tag_Normal = Exif.createTag(0, "Normal"); 600 601 public static final Tag Tag_Lowsaturation = Exif.createTag(1, "Lowsaturation"); 602 603 public static final Tag Tag_Highsaturation = Exif.createTag(2, "Highsaturation"); 604 605 } 606 607 public interface Sharpness { 608 609 public static final Tag Tag_Normal = Exif.createTag(0, "Normal"); 610 611 public static final Tag Tag_Soft = Exif.createTag(1, "Soft"); 612 613 public static final Tag Tag_Hard = Exif.createTag(2, "Hard"); 614 615 } 616 617 public interface SubjectDistanceRange { 618 619 public static final Tag Tag_Unknown = Exif.createTag(0, "Unknown"); 620 621 public static final Tag Tag_Macro = Exif.createTag(1, "Macro"); 622 623 public static final Tag Tag_Closeview = Exif.createTag(2, "Closeview"); 624 625 public static final Tag Tag_Distantview = Exif.createTag(3, "Distantview"); 626 627 } 628 629 public interface FileSource { 630 631 public static final Tag Tag_DSC = Exif.createTag(3, "DSC"); 632 633 } 634 635 public interface Components { 636 637 public static final Tag Tag_ = Exif.createTag(0, ""); 638 639 public static final Tag Tag_Y = Exif.createTag(1, "Y"); 640 641 public static final Tag Tag_Cb = Exif.createTag(2, "Cb"); 642 643 public static final Tag Tag_Cr = Exif.createTag(3, "Cr"); 644 645 public static final Tag Tag_R = Exif.createTag(4, "R"); 646 647 public static final Tag Tag_G = Exif.createTag(5, "G"); 648 649 public static final Tag Tag_B = Exif.createTag(6, "B"); 650 651 } 652 653 } 654 655}
点赞
收藏

评论区

加载中...

相关推荐

MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1

文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s

Oracle 分组与拼接字符串同时使用

SELECTT.,ROWNUMIDFROM(SELECTT.EMPLID,T.NAME,T.BU,T.REALDEPART,T.FORMATDATE,SUM(T.S0)S0,MAX(UPDATETIME)CREATETIME,LISTAGG(TOCHAR(

MySQL部分从库上面因为大量的临时表tmp_table造成慢查询

背景描述Time:20190124T00:08:14.70572408:00User@Host:@Id:Schema:sentrymetaLast_errno:0Killed:0Query_time:0.315758Lock_

皕杰报表之UUID

​在我们用皕杰报表工具设计填报报表时,如何在新增行里自动增加id呢?能新增整数排序id吗?目前可以在新增行里自动增加id,但只能用uuid函数增加UUID编码,不能新增整数排序id。uuid函数说明:获取一个UUID,可以在填报表中用来创建数据ID语法:uuid()或uuid(sep)参数说明:sep布尔值,生成的uuid中是否包含分隔符'',缺省为

手写Java HashMap源码

HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程HashMap的使用教程22

Java日期时间API系列31

  时间戳是指格林威治时间1970年01月01日00时00分00秒起至现在的总毫秒数,是所有时间的基础,其他时间可以通过时间戳转换得到。Java中本来已经有相关获取时间戳的方法,Java8后增加新的类Instant等专用于处理时间戳问题。 1获取时间戳的方法和性能对比1.1获取时间戳方法Java8以前