文档章节

java 读取JPEG图像的Exif信息

IamOkay
 IamOkay
发布于 2017/01/07 08:47
字数 3310
阅读 64
收藏 0

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

package com.uap.test;

import java.io.ByteArrayOutputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

import org.json.JSONException;
import org.json.JSONObject;

import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

public class JpegDecodeTest {

	
	public static byte[] getJPEGBytes(String filename)
	{
		FileInputStream fis = null;
		try {
			fis = new FileInputStream(filename);
			int available = fis.available();
			ByteArrayOutputStream baos = new ByteArrayOutputStream(available);
			int len = -1;
			byte[] buf = new byte[1028];
			while ((len=fis.read(buf, 0, buf.length))!=-1)
			{
				baos.write(buf, 0, len);
			}
			return baos.toByteArray();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}finally{
			if(fis!=null)
			{
				try {
					fis.close();
				} catch (IOException e) {
				}
			}
		}
		return null;
	}
	public static void main(String[] args) throws JSONException, IOException {
			
		byte[] buf = getJPEGBytes("ttt.png");
		for (int i = 0; i < buf.length; i++)
		{
				int b = buf[i]&0xff;
				if(i>0 &&buf[i-1]==-1)
				{
						String s = null;
						switch (b) {
						case 0xD8:
							s = "SOI";
							break;
						case 0xDB:
							s = "DQT";
							showJPEGDHQ(buf,i);
							break;
						case 0xE0:
						{
							s = "APP0";
							showJPEGApp0(buf,i);
						}
							break;
						case 0xC0:
							s = "SOF0";
							showJPEGSOF0(buf,i);
							break;
						case 0xC4:
							s = "DHT";
							break;
						case 0xDD:
							s = "DRI";
							break;
						case 0xDA:
							s = "SOS";
							break;
						case 0xD9:
							s = "EOI";
							break;
							
						default:
						{
							int H = (int)(b&0xff);
							if(H>=0xE1 && 0xEF>=H)
							{
								s = "APPE"+(H-225+1);
								showJPEGAppH(buf, i);
							}
						}
							break;
						}
						if(s!=null)
						{
							System.out.println(" FIND-Flag: "+s);
						}
					}
				}
		
	}
	private static void showJPEGDHQ(byte[] buf, int i)
	{

		if(buf==null || buf.length<=i)
		{
			return;
		}
		int startIndex = i+1;
		int len = getByteToInteger(buf, startIndex, 2, true);
		System.out.println("DHQ长度:"+len);
	}
	private static void showJPEGSOF0(byte[] buf, int i)
	{
		if(buf==null || buf.length<=i)
		{
			return;
		}
		int startIndex = i+1;
		int len = getByteToInteger(buf, startIndex, 2, true);
		System.out.println("App0长度:"+len);
		byte[] sof0Buf = new byte[len];
		System.arraycopy(buf, startIndex, sof0Buf, 0, len);
		startIndex = 0;
		startIndex = startIndex + 2;
		
		int degree = sof0Buf[startIndex]&0XFF; //精度
		int width = getByteToInteger(sof0Buf, startIndex+1, 2, true);
		int height = getByteToInteger(sof0Buf, startIndex+3, 2, true);
		int xyDelta = sof0Buf[startIndex+5]&0XFF; //颜色分量
		startIndex = startIndex + 6;
		int restLen = len - startIndex;
		
		
	}
	private static void showJPEGApp0(byte[] buf, int i)
	{
		
		if(buf==null || buf.length<=i)
		{
			return;
		}
		int startIndex = i+1;
		int len = getByteToInteger(buf, startIndex, 2, true);
		System.out.println("App0长度:"+len);
		
		startIndex = startIndex +2;
		String flag = getStrings(buf, startIndex, 5).trim();
		System.out.println("flag:"+flag);
		
		if("JFIF".equalsIgnoreCase(flag))
		{
			startIndex = startIndex+5;
			String version = (buf[startIndex]&0xFF) +"."+(buf[startIndex+1]&0xFF);
			System.out.println("version="+version);
			
			startIndex = startIndex +2;
			int densityUnit = buf[startIndex]&0xFF; //像素单位
			
			int XDensity = getByteToInteger(buf, startIndex+1, 2, true);
			int YDensity = getByteToInteger(buf, startIndex+3, 2, true);
			
			startIndex = startIndex +5;
			String XYPixesBlockNumbers = (buf[startIndex]&0xFF) +"/"+(buf[startIndex+1]&0xFF);
			startIndex = startIndex +2;
			
			System.out.println("densityUnit="+densityUnit+", XDensity="+XDensity+", YDensity="+YDensity+", XYPixesBlockNumbers="+XYPixesBlockNumbers);
			int rest = len - (startIndex-i-1);
			if("0/0".equals(XYPixesBlockNumbers) || rest==0)
			{
				System.out.println("没有缩略图位图!");
			}else{
				byte[] bmpBytes = new byte[rest];
				System.arraycopy(buf, startIndex, bmpBytes, 0, rest);
				System.out.println("RGB位图大小:"+bmpBytes.length);
			}
		
		}
		
	}
	private static void showJPEGAppH(byte[] buf, int i) throws IOException
	{
		
		if(buf==null || buf.length<=i)
		{
			return;
		}
		int len = getByteToInteger(buf, i+1, 2, true);
		System.out.println("本段长度:"+len);
		
		byte[] appbuf = new byte[len];
		System.arraycopy(buf, i+1, appbuf, 0, len);
		
		int k = 2;
		
		String strIfExif = getStrings(appbuf, k, 4);
		if("Exif".equalsIgnoreCase(strIfExif))
		{
			int iTIFFOffset = k + 4;
			//大小端保存问题,占4个字节
			int bytesToInt = getByteToInteger(appbuf, iTIFFOffset, 4, true);
			boolean isBigEndian = false;
			if(bytesToInt==0x4949)
			{ //小端模式
				isBigEndian = false; 
			}else if(bytesToInt==0x4D4D){ //大端模式
				isBigEndian = true;
			}else{
				System.out.println("Not valid TIFF data! (no 0x4949 or 0x4D4D)");
				return;
			}
			
			if(isBigEndian)
			{
				System.out.println("大端模式");
				
				iTIFFOffset = iTIFFOffset + 4;
				int checkNumber = getByteToInteger(appbuf, iTIFFOffset, 2, isBigEndian);
				System.out.println("checkNumber="+checkNumber);
				boolean isValidExif = true;
				if(checkNumber!=0x002A){
					isValidExif = false;
					System.out.println("Not valid TIFF data! (no 0x002A)");
					return;
				}
				iTIFFOffset = iTIFFOffset + 2;
				checkNumber = getByteToInteger(appbuf, iTIFFOffset, 4,isBigEndian);
				System.out.println("checkNumber="+checkNumber);
				
				if (checkNumber!= 0x0008) 
				{
					isValidExif = false;
					System.out.println("Not valid TIFF data! (First offset not 8)");
					return;
				}
				
				Map<String, Object> map = readTagInfo(Exif.TiffTags.class, appbuf, iTIFFOffset,iTIFFOffset+4, isBigEndian);
				if(map.containsKey("ExifIFDPointer"))
				{	
					 int ExifIFDPointerOffset  = (int) map.get("ExifIFDPointer")+iTIFFOffset-4;
					 System.out.println(ExifIFDPointerOffset);
					 Map<String, Object> readTagInfo = readTagInfo(Exif.Tags.class, appbuf, iTIFFOffset,ExifIFDPointerOffset, isBigEndian);
					 map.putAll(readTagInfo);
				}
				
				if (map.containsKey("GPSInfoIFDPointer")) {
					 int GPSInfoIFDPointer  = (int) map.get("GPSInfoIFDPointer")+iTIFFOffset-4;
					 System.out.println(GPSInfoIFDPointer);
					 Map<String, Object> readTagInfo = readTagInfo(Exif.GPSTags.class, appbuf, iTIFFOffset,GPSInfoIFDPointer, isBigEndian);
					 map.putAll(readTagInfo);
				}
				
				System.out.println(map);
			}else{
				System.out.println("小端模式");
			}
			
		}else{
			strIfExif = new String(buf, i,len);
			System.out.println(strIfExif);
		}
	}
	private static Map<String, Object> readTagInfo(Class clazz, byte[] appbuf, int iTIFFOffset,int startDir, boolean isBigEndian) {
		int iEntries = getByteToInteger(appbuf, startDir, 2, isBigEndian);
		Map<String, Object> map = new HashMap<String, Object>();
		for (int t=0;t<iEntries;t++) 
		{
			int iEntryOffset = (startDir+2) + t*12; //每个报文段长度是12
			
			int iType 			= getByteToInteger(appbuf, iEntryOffset+2, 2, isBigEndian);
			int iNumValues 		= getByteToInteger(appbuf, iEntryOffset+4, 4, isBigEndian);
			//计算数据的偏移位置
			int iValueOffset 	= getByteToInteger(appbuf, iEntryOffset+8, 4, isBigEndian)+iTIFFOffset-4;
			
			String strTag = readTag(clazz,getByteToInteger(appbuf, iEntryOffset, 2, isBigEndian),isBigEndian);
			Object values = readTagValue(appbuf,iType,iValueOffset,iNumValues,iEntryOffset);
			System.err.println(strTag+"["+iType+","+iNumValues+","+iValueOffset+"] ="+values);
			map.put(strTag, values);
		}
		return map;
	}
	
	private static Object readTagValue(byte[] appbuf, int iType, int iValueOffset,int iNumValues,int iEntryOffset) {
		
		Object value = null;
		switch (iType) {
		case 1:
		case 7:
		{
			if (iNumValues == 1) {
				value =  appbuf[iEntryOffset + 8];
			} else {
				int iValOffset = iNumValues > 4 ? iValueOffset : (iEntryOffset + 8);
				String[] aVals = new String[iNumValues];
				for (int n=0;n<iNumValues;n++) {
					aVals[n] = appbuf[iValOffset + n]+"";
				}
				value = Arrays.asList(aVals);
			}
		}
			break;
		case 2:
			int iStringOffset = iNumValues>4?iValueOffset : (iEntryOffset + 8);
			value = getStrings(appbuf,iStringOffset,iNumValues-1);
			break;
		case 3:
		{
			if (iNumValues == 1) {
				value = getByteToInteger(appbuf, iEntryOffset+8, 4, true);
			} else if(iNumValues >= 2){
				int iValOffset = iNumValues > 2 ? iValueOffset : (iEntryOffset + 8);
				String[] aVals = new String[iNumValues];
				for (int n=0;n<iNumValues;n++) {
					aVals[n] =getByteToInteger(appbuf, iValueOffset + 2*n, 4, true)+"";
				}
				value = Arrays.asList(aVals);
			}
		}
			break;
		case 4:
		{
			if (iNumValues == 1) {
				value = getByteToInteger(appbuf, iEntryOffset+8, 4, true);
			} else {
				String[] aVals = new String[iNumValues];
				for (int n=0;n<iNumValues;n++) {
					aVals[n] =getByteToInteger(appbuf, iValueOffset + 4*n, 4, true)+"";
				}
				value = Arrays.asList(aVals);
			}
		}
			break;
		case 5:
		{
			if (iNumValues == 1) {
				value = ""+getByteToInteger(appbuf, iValueOffset, 4, true)+"/"+getByteToInteger(appbuf, iValueOffset+4, 4, true);
			} else {
				String[] values = new String[iNumValues];
				for (int n=0;n<iNumValues;n++) {
					values[n] = getByteToInteger(appbuf, iValueOffset+8*n, 4, true) +"/"+ getByteToInteger(appbuf, iValueOffset+4+8*n, 4, true);
				}
				value = Arrays.asList(values);
			}
		}
			break;
		case 9:
			
			break;
		case 10:
		{
			if (iNumValues == 1) {
				value = getByteToInteger(appbuf, iValueOffset, 4, true) +"/"+getByteToInteger(appbuf, iValueOffset+4, 4, true);
			} else {
				String[] aVals = new String[iNumValues];
				for (int n=0;n<iNumValues;n++) {
					aVals[n] = ""+getByteToInteger(appbuf,iValueOffset + 8*n,4, true) +"/"+ getByteToInteger(appbuf,iValueOffset+4 + 8*n,4, true);
				}
				value = Arrays.asList(aVals);
			}
		}
			break;
		default:
			System.err.println("Invalid range ["+iType+","+iNumValues+","+iValueOffset+"]");
			break;
		}
		
		return value;
	}
	private static String readTag(Class clazz,int id,boolean isBigEndian) 
	{
		Field[] fields = clazz.getDeclaredFields();
		try {
			for (Field field : fields) {
				field.setAccessible(true);
				if(!Modifier.isStatic(field.getModifiers()))
				{
					continue;
				}
				Tag tag = (Tag) field.get(clazz);
				if(tag.getId()==id)
				{
					return tag.getName();
				}
			}
		} catch (SecurityException e) {
			e.printStackTrace();
		} catch (IllegalArgumentException e) {
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		}
		return null;
	}
	private static String getStrings( byte[] bs) 
	{
		return new String(bs, 0,bs.length);
	}
	
	private static String getStrings( byte[] bs,int start,int length) 
	{
		return new String(bs, start,length);
	}
	
	private static int getByteToInteger(byte[] bs,int start,int length,boolean isBigEndian)
	{
		byte[] tmpBuf = new byte[]{0,0,0,0};
		if(length==2)
		{
			tmpBuf[2] = bs[start];
			tmpBuf[3] = bs[start+1];
		}else if(length==4){
			tmpBuf[0] = bs[start];
			tmpBuf[1] = bs[start+1];
			tmpBuf[2] = bs[start+2];
			tmpBuf[3] = bs[start+3];
		}
		
		return isBigEndian?bytesToInt(tmpBuf):bytesToIntLitterEndian(tmpBuf);
	}
	
	/**
	 * 大端模式
	 * @param src
	 * @return
	 */
	public static int bytesToInt(byte[] src) {  
	    int value;    
	    int offset = 0;
	    value = (int) ( ((src[offset] & 0xFF)<<24)  
	            |((src[offset+1] & 0xFF)<<16)  
	            |((src[offset+2] & 0xFF)<<8)  
	            |(src[offset+3] & 0xFF)); 
	    return value;  
	}  
	/**
	 * 小端模式
	 * @param src
	 * @return
	 */
	public static int bytesToIntLitterEndian(byte[] src) {  
	    int value;    
	    int offset = 0;
	    value = (int) ( ((src[offset+3] & 0xFF)<<24)  
	            |((src[offset+2] & 0xFF)<<16)  
	            |((src[offset+1] & 0xFF)<<8)  
	            |(src[offset] & 0xFF)); 
	    return value;  
	}  
}

辅助类

package com.uap.test;

import java.io.*;

public class Exif {

	public static Tag createTag(int id, String name) {
		return new Tag(id, name);
	}

	public interface Tags {

		public static final Tag Tag_ExifVersion = Exif.createTag(0x9000, "ExifVersion");

		// EXIFversion
		public static final Tag Tag_FlashpixVersion = Exif.createTag(0xA000, "FlashpixVersion");

		// Flashpixformatversion
		public static final Tag Tag_ColorSpace = Exif.createTag(0xA001, "ColorSpace");

		// Colorspaceinformationtag
		public static final Tag Tag_PixelXDimension = Exif.createTag(0xA002, "PixelXDimension");

		// Validwidthofmeaningfulimage
		public static final Tag Tag_PixelYDimension = Exif.createTag(0xA003, "PixelYDimension");

		// Validheightofmeaningfulimage
		public static final Tag Tag_ComponentsConfiguration = Exif.createTag(0x9101, "ComponentsConfiguration");

		// Informationaboutchannels
		public static final Tag Tag_CompressedBitsPerPixel = Exif.createTag(0x9102, "CompressedBitsPerPixel");

		// Compressedbitsperpixel

		public static final Tag Tag_MakerNote = Exif.createTag(0x927C, "MakerNote");

		// Anydesiredinformationwrittenbythemanufacturer
		public static final Tag Tag_UserComment = Exif.createTag(0x9286, "UserComment");

		// Commentsbyuser
		public static final Tag Tag_RelatedSoundFile = Exif.createTag(0xA004, "RelatedSoundFile");

		// Nameofrelatedsoundfile
		public static final Tag Tag_DateTimeOriginal = Exif.createTag(0x9003, "DateTimeOriginal");

		// Dateandtimewhentheoriginalimagewasgenerated

		public static final Tag Tag_DateTimeDigitized = Exif.createTag(0x9004, "DateTimeDigitized");

		// Dateandtimewhentheimagewasstoreddigitally

		public static final Tag Tag_SubsecTime = Exif.createTag(0x9290, "SubsecTime");

		// FractionsofsecondsforDateTime

		public static final Tag Tag_SubsecTimeOriginal = Exif.createTag(0x9291, "SubsecTimeOriginal");

		// FractionsofsecondsforDateTimeOriginal

		public static final Tag Tag_SubsecTimeDigitized = Exif.createTag(0x9292, "SubsecTimeDigitized");

		// FractionsofsecondsforDateTimeDigitized

		public static final Tag Tag_ExposureTime = Exif.createTag(0x829A, "ExposureTime");

		// Exposuretime(inseconds)

		public static final Tag Tag_FNumber = Exif.createTag(0x829D, "FNumber");

		// Fnumber

		public static final Tag Tag_ExposureProgram = Exif.createTag(0x8822, "ExposureProgram");

		// Exposureprogram

		public static final Tag Tag_SpectralSensitivity = Exif.createTag(0x8824, "SpectralSensitivity");

		// Spectralsensitivity

		public static final Tag Tag_ISOSpeedRatings = Exif.createTag(0x8827, "ISOSpeedRatings");

		// ISOspeedrating

		public static final Tag Tag_OECF = Exif.createTag(0x8828, "OECF");

		// Optoelectricconversionfactor

		public static final Tag Tag_ShutterSpeedValue = Exif.createTag(0x9201, "ShutterSpeedValue");

		// Shutterspeed

		public static final Tag Tag_ApertureValue = Exif.createTag(0x9202, "ApertureValue");

		// Lensaperture

		public static final Tag Tag_BrightnessValue = Exif.createTag(0x9203, "BrightnessValue");

		// Valueofbrightness

		public static final Tag Tag_ExposureBias = Exif.createTag(0x9204, "ExposureBias");

		// Exposurebias

		public static final Tag Tag_MaxApertureValue = Exif.createTag(0x9205, "MaxApertureValue");

		// SmallestFnumberoflens

		public static final Tag Tag_SubjectDistance = Exif.createTag(0x9206, "SubjectDistance");

		// Distancetosubjectinmeters

		public static final Tag Tag_MeteringMode = Exif.createTag(0x9207, "MeteringMode");

		// Meteringmode

		public static final Tag Tag_LightSource = Exif.createTag(0x9208, "LightSource");

		// Kindoflightsource

		public static final Tag Tag_Flash = Exif.createTag(0x9209, "Flash");

		// Flashstatus

		public static final Tag Tag_SubjectArea = Exif.createTag(0x9214, "SubjectArea");

		// Locationandareaofmainsubject

		public static final Tag Tag_FocalLength = Exif.createTag(0x920A, "FocalLength");

		// Focallengthofthelensinmm

		public static final Tag Tag_FlashEnergy = Exif.createTag(0xA20B, "FlashEnergy");

		// StrobeenergyinBCPS

		public static final Tag Tag_SpatialFrequencyResponse = Exif.createTag(0xA20C, "SpatialFrequencyResponse");

		public static final Tag Tag_FocalPlaneXResolution = Exif.createTag(0xA20E, "FocalPlaneXResolution");

		// NumberofpixelsinwidthdirectionperFocalPlaneResolutionUnit

		public static final Tag Tag_FocalPlaneYResolution = Exif.createTag(0xA20F, "FocalPlaneYResolution");

		// NumberofpixelsinheightdirectionperFocalPlaneResolutionUnit

		public static final Tag Tag_FocalPlaneResolutionUnit = Exif.createTag(0xA210, "FocalPlaneResolutionUnit");

		// UnitformeasuringFocalPlaneXResolutionandFocalPlaneYResolution

		public static final Tag Tag_SubjectLocation = Exif.createTag(0xA214, "SubjectLocation");

		// Locationofsubjectinimage

		public static final Tag Tag_ExposureIndex = Exif.createTag(0xA215, "ExposureIndex");

		// Exposureindexselectedoncamera

		public static final Tag Tag_SensingMethod = Exif.createTag(0xA217, "SensingMethod");

		// Imagesensortype

		public static final Tag Tag_FileSource = Exif.createTag(0xA300, "FileSource");

		// Imagesource(3DSC)

		public static final Tag Tag_SceneType = Exif.createTag(0xA301, "SceneType");

		// Scenetype(1directlyphotographed)

		public static final Tag Tag_CFAPattern = Exif.createTag(0xA302, "CFAPattern");

		// Colorfilterarraygeometricpattern

		public static final Tag Tag_CustomRendered = Exif.createTag(0xA401, "CustomRendered");

		// Specialprocessing

		public static final Tag Tag_ExposureMode = Exif.createTag(0xA402, "ExposureMode");

		// Exposuremode

		public static final Tag Tag_WhiteBalance = Exif.createTag(0xA403, "WhiteBalance");

		// 1autowhitebalance,2manual

		public static final Tag Tag_DigitalZoomRation = Exif.createTag(0xA404, "DigitalZoomRation");

		// Digitalzoomratio

		public static final Tag Tag_FocalLengthIn35mmFilm = Exif.createTag(0xA405, "FocalLengthIn35mmFilm");

		// Equivalentfoacllengthassuming35mmfilmcamera(inmm)

		public static final Tag Tag_SceneCaptureType = Exif.createTag(0xA406, "SceneCaptureType");

		// Typeofscene

		public static final Tag Tag_GainControl = Exif.createTag(0xA407, "GainControl");

		// Degreeofoverallimagegainadjustment

		public static final Tag Tag_Contrast = Exif.createTag(0xA408, "Contrast");

		// Directionofcontrastprocessingappliedbycamera

		public static final Tag Tag_Saturation = Exif.createTag(0xA409, "Saturation");

		// Directionofsaturationprocessingappliedbycamera

		public static final Tag Tag_Sharpness = Exif.createTag(0xA40A, "Sharpness");

		// Directionofsharpnessprocessingappliedbycamera

		public static final Tag Tag_DeviceSettingDescription = Exif.createTag(0xA40B, "DeviceSettingDescription");

		public static final Tag Tag_SubjectDistanceRange = Exif.createTag(0xA40C, "SubjectDistanceRange");

		// Distancetosubject

		public static final Tag Tag_InteroperabilityIFDPointer = Exif.createTag(0xA005, "InteroperabilityIFDPointer");

		public static final Tag Tag_ImageUniqueID = Exif.createTag(0xA420, "ImageUniqueID");

		// Identifierassigneduniquelytoeachimage

	}

	public interface TiffTags {

		public static final Tag Tag_ImageWidth = Exif.createTag(0x0100, "ImageWidth");

		public static final Tag Tag_ImageHeight = Exif.createTag(0x0101, "ImageHeight");

		public static final Tag Tag_ExifIFDPointer = Exif.createTag(0x8769, "ExifIFDPointer");

		public static final Tag Tag_GPSInfoIFDPointer = Exif.createTag(0x8825, "GPSInfoIFDPointer");

		public static final Tag Tag_InteroperabilityIFDPointer = Exif.createTag(0xA005, "InteroperabilityIFDPointer");

		public static final Tag Tag_BitsPerSample = Exif.createTag(0x0102, "BitsPerSample");

		public static final Tag Tag_Compression = Exif.createTag(0x0103, "Compression");

		public static final Tag Tag_PhotometricInterpretation = Exif.createTag(0x0106, "PhotometricInterpretation");

		public static final Tag Tag_Orientation = Exif.createTag(0x0112, "Orientation");

		public static final Tag Tag_SamplesPerPixel = Exif.createTag(0x0115, "SamplesPerPixel");

		public static final Tag Tag_PlanarConfiguration = Exif.createTag(0x011C, "PlanarConfiguration");

		public static final Tag Tag_YCbCrSubSampling = Exif.createTag(0x0212, "YCbCrSubSampling");

		public static final Tag Tag_YCbCrPositioning = Exif.createTag(0x0213, "YCbCrPositioning");

		public static final Tag Tag_XResolution = Exif.createTag(0x011A, "XResolution");

		public static final Tag Tag_YResolution = Exif.createTag(0x011B, "YResolution");

		public static final Tag Tag_ResolutionUnit = Exif.createTag(0x0128, "ResolutionUnit");

		public static final Tag Tag_StripOffsets = Exif.createTag(0x0111, "StripOffsets");

		public static final Tag Tag_RowsPerStrip = Exif.createTag(0x0116, "RowsPerStrip");

		public static final Tag Tag_StripByteCounts = Exif.createTag(0x0117, "StripByteCounts");

		public static final Tag Tag_JPEGInterchangeFormat = Exif.createTag(0x0201, "JPEGInterchangeFormat");

		public static final Tag Tag_JPEGInterchangeFormatLength = Exif.createTag(0x0202, "JPEGInterchangeFormatLength");

		public static final Tag Tag_TransferFunction = Exif.createTag(0x012D, "TransferFunction");

		public static final Tag Tag_WhitePoint = Exif.createTag(0x013E, "WhitePoint");

		public static final Tag Tag_PrimaryChromaticities = Exif.createTag(0x013F, "PrimaryChromaticities");

		public static final Tag Tag_YCbCrCoefficients = Exif.createTag(0x0211, "YCbCrCoefficients");

		public static final Tag Tag_ReferenceBlackWhite = Exif.createTag(0x0214, "ReferenceBlackWhite");

		public static final Tag Tag_DateTime = Exif.createTag(0x0132, "DateTime");

		public static final Tag Tag_ImageDescription = Exif.createTag(0x010E, "ImageDescription");

		public static final Tag Tag_Make = Exif.createTag(0x010F, "Make");

		public static final Tag Tag_Model = Exif.createTag(0x0110, "Model");

		public static final Tag Tag_Software = Exif.createTag(0x0131, "Software");

		public static final Tag Tag_Artist = Exif.createTag(0x013B, "Artist");

		public static final Tag Tag_Copyright = Exif.createTag(0x8298, "Copyright");

	}

	public interface GPSTags {

		public static final Tag Tag_GPSVersionID = Exif.createTag(0x0000, "GPSVersionID");

		public static final Tag Tag_GPSLatitudeRef = Exif.createTag(0x0001, "GPSLatitudeRef");

		public static final Tag Tag_GPSLatitude = Exif.createTag(0x0002, "GPSLatitude");

		public static final Tag Tag_GPSLongitudeRef = Exif.createTag(0x0003, "GPSLongitudeRef");

		public static final Tag Tag_GPSLongitude = Exif.createTag(0x0004, "GPSLongitude");

		public static final Tag Tag_GPSAltitudeRef = Exif.createTag(0x0005, "GPSAltitudeRef");

		public static final Tag Tag_GPSAltitude = Exif.createTag(0x0006, "GPSAltitude");

		public static final Tag Tag_GPSTimeStamp = Exif.createTag(0x0007, "GPSTimeStamp");

		public static final Tag Tag_GPSSatellites = Exif.createTag(0x0008, "GPSSatellites");

		public static final Tag Tag_GPSStatus = Exif.createTag(0x0009, "GPSStatus");

		public static final Tag Tag_GPSMeasureMode = Exif.createTag(0x000A, "GPSMeasureMode");

		public static final Tag Tag_GPSDOP = Exif.createTag(0x000B, "GPSDOP");

		public static final Tag Tag_GPSSpeedRef = Exif.createTag(0x000C, "GPSSpeedRef");

		public static final Tag Tag_GPSSpeed = Exif.createTag(0x000D, "GPSSpeed");

		public static final Tag Tag_GPSTrackRef = Exif.createTag(0x000E, "GPSTrackRef");

		public static final Tag Tag_GPSTrack = Exif.createTag(0x000F, "GPSTrack");

		public static final Tag Tag_GPSImgDirectionRef = Exif.createTag(0x0010, "GPSImgDirectionRef");

		public static final Tag Tag_GPSImgDirection = Exif.createTag(0x0011, "GPSImgDirection");

		public static final Tag Tag_GPSMapDatum = Exif.createTag(0x0012, "GPSMapDatum");

		public static final Tag Tag_GPSDestLatitudeRef = Exif.createTag(0x0013, "GPSDestLatitudeRef");

		public static final Tag Tag_GPSDestLatitude = Exif.createTag(0x0014, "GPSDestLatitude");

		public static final Tag Tag_GPSDestLongitudeRef = Exif.createTag(0x0015, "GPSDestLongitudeRef");

		public static final Tag Tag_GPSDestLongitude = Exif.createTag(0x0016, "GPSDestLongitude");

		public static final Tag Tag_GPSDestBearingRef = Exif.createTag(0x0017, "GPSDestBearingRef");

		public static final Tag Tag_GPSDestBearing = Exif.createTag(0x0018, "GPSDestBearing");

		public static final Tag Tag_GPSDestDistanceRef = Exif.createTag(0x0019, "GPSDestDistanceRef");

		public static final Tag Tag_GPSDestDistance = Exif.createTag(0x001A, "GPSDestDistance");

		public static final Tag Tag_GPSProcessingMethod = Exif.createTag(0x001B, "GPSProcessingMethod");

		public static final Tag Tag_GPSAreaInformation = Exif.createTag(0x001C, "GPSAreaInformation");

		public static final Tag Tag_GPSDateStamp = Exif.createTag(0x001D, "GPSDateStamp");

		public static final Tag Tag_GPSDifferential = Exif.createTag(0x001E, "GPSDifferential");

	}

	public interface StringValues {

		public interface ExposureProgram {

			public static final Tag Tag_Notdefined = Exif.createTag(0, "Notdefined");

			public static final Tag Tag_Manual = Exif.createTag(1, "Manual");

			public static final Tag Tag_Normalprogram = Exif.createTag(2, "Normalprogram");

			public static final Tag Tag_Aperturepriority = Exif.createTag(3, "Aperturepriority");

			public static final Tag Tag_Shutterpriority = Exif.createTag(4, "Shutterpriority");

			public static final Tag Tag_Creativeprogram = Exif.createTag(5, "Creativeprogram");

			public static final Tag Tag_Actionprogram = Exif.createTag(6, "Actionprogram");

			public static final Tag Tag_Portraitmode = Exif.createTag(7, "Portraitmode");

			public static final Tag Tag_Landscapemode = Exif.createTag(8, "Landscapemode");

		}

		public interface MeteringMode {

			public static final Tag Tag_Unknown = Exif.createTag(0, "Unknown");

			public static final Tag Tag_Average = Exif.createTag(1, "Average");

			public static final Tag Tag_CenterWeightedAverage = Exif.createTag(2, "CenterWeightedAverage");

			public static final Tag Tag_Spot = Exif.createTag(3, "Spot");

			public static final Tag Tag_MultiSpot = Exif.createTag(4, "MultiSpot");

			public static final Tag Tag_Pattern = Exif.createTag(5, "Pattern");

			public static final Tag Tag_Partial = Exif.createTag(6, "Partial");

			public static final Tag Tag_Other = Exif.createTag(255, "Other");

		}

		public interface LightSource {

			public static final Tag Tag_Unknown = Exif.createTag(0, "Unknown");

			public static final Tag Tag_Daylight = Exif.createTag(1, "Daylight");

			public static final Tag Tag_Fluorescent = Exif.createTag(2, "Fluorescent");

			public static final Tag Tag_Tungstenincandescentlight = Exif.createTag(3, "Tungstenincandescentlight");

			public static final Tag Tag_Flash = Exif.createTag(4, "Flash");

			public static final Tag Tag_Fineweather = Exif.createTag(9, "Fineweather");

			public static final Tag Tag_Cloudyweather = Exif.createTag(10, "Cloudyweather");

			public static final Tag Tag_Shade = Exif.createTag(11, "Shade");

			public static final Tag Tag_DaylightfluorescentD57007100K = Exif.createTag(12,
					"DaylightfluorescentD57007100K");

			public static final Tag Tag_DaywhitefluorescentN46005400K = Exif.createTag(13,
					"DaywhitefluorescentN46005400K");

			public static final Tag Tag_CoolwhitefluorescentW39004500K = Exif.createTag(14,
					"CoolwhitefluorescentW39004500K");

			public static final Tag Tag_WhitefluorescentWW32003700K = Exif.createTag(15, "WhitefluorescentWW32003700K");

			public static final Tag Tag_StandardlightA = Exif.createTag(17, "StandardlightA");

			public static final Tag Tag_StandardlightB = Exif.createTag(18, "StandardlightB");

			public static final Tag Tag_StandardlightC = Exif.createTag(19, "StandardlightC");

			public static final Tag Tag_D55 = Exif.createTag(20, "D55");

			public static final Tag Tag_D65 = Exif.createTag(21, "D65");

			public static final Tag Tag_D75 = Exif.createTag(22, "D75");

			public static final Tag Tag_D50 = Exif.createTag(23, "D50");

			public static final Tag Tag_ISOstudiotungsten = Exif.createTag(24, "ISOstudiotungsten");

			public static final Tag Tag_Other = Exif.createTag(255, "Other");

		}

		public interface Flash {

			public static final Tag Tag_Flashdidnotfire = Exif.createTag(0x0000, "Flashdidnotfire");

			public static final Tag Tag_Flashfired = Exif.createTag(0x0001, "Flashfired");

			public static final Tag Tag_Strobereturnlightnotdetected = Exif.createTag(0x0005,
					"Strobereturnlightnotdetected");

			public static final Tag Tag_Strobereturnlightdetected = Exif.createTag(0x0007, "Strobereturnlightdetected");

			public static final Tag Tag_Flashfiredcompulsoryflashmode = Exif.createTag(0x0009,
					"Flashfiredcompulsoryflashmode");

			public static final Tag Tag_Flashfiredcompulsoryflashmodereturnlightnotdetected = Exif.createTag(0x000D,
					"Flashfiredcompulsoryflashmodereturnlightnotdetected");

			public static final Tag Tag_Flashfiredcompulsoryflashmodereturnlightdetected = Exif.createTag(0x000F,
					"Flashfiredcompulsoryflashmodereturnlightdetected");

			public static final Tag Tag_Flashdidnotfirecompulsoryflashmode = Exif.createTag(0x0010,
					"Flashdidnotfirecompulsoryflashmode");

			public static final Tag Tag_Flashdidnotfireautomode = Exif.createTag(0x0018, "Flashdidnotfireautomode");

			public static final Tag Tag_Flashfiredautomode = Exif.createTag(0x0019, "Flashfiredautomode");

			public static final Tag Tag_Flashfiredautomodereturnlightnotdetected = Exif.createTag(0x001D,
					"Flashfiredautomodereturnlightnotdetected");

			public static final Tag Tag_Flashfiredautomodereturnlightdetected = Exif.createTag(0x001F,
					"Flashfiredautomodereturnlightdetected");

			public static final Tag Tag_Noflashfunction = Exif.createTag(0x0020, "Noflashfunction");

			public static final Tag Tag_Flashfiredredeyereductionmode = Exif.createTag(0x0041,
					"Flashfiredredeyereductionmode");

			public static final Tag Tag_Flashfiredredeyereductionmodereturnlightnotdetected = Exif.createTag(0x0045,
					"Flashfiredredeyereductionmodereturnlightnotdetected");

			public static final Tag Tag_Flashfiredredeyereductionmodereturnlightdetected = Exif.createTag(0x0047,
					"Flashfiredredeyereductionmodereturnlightdetected");

			public static final Tag Tag_Flashfiredcompulsoryflashmoderedeyereductionmode = Exif.createTag(0x0049,
					"Flashfiredcompulsoryflashmoderedeyereductionmode");

			public static final Tag Tag_Flashfiredcompulsoryflashmoderedeyereductionmodereturnlightnotdetected = Exif
					.createTag(0x004D, "Flashfiredcompulsoryflashmoderedeyereductionmodereturnlightnotdetected");

			public static final Tag Tag_Flashfiredcompulsoryflashmoderedeyereductionmodereturnlightdetected = Exif
					.createTag(0x004F, "Flashfiredcompulsoryflashmoderedeyereductionmodereturnlightdetected");

			public static final Tag Tag_Flashfiredautomoderedeyereductionmode = Exif.createTag(0x0059,
					"Flashfiredautomoderedeyereductionmode");

			public static final Tag Tag_Flashfiredautomodereturnlightnotdetectedredeyereductionmode = Exif
					.createTag(0x005D, "Flashfiredautomodereturnlightnotdetectedredeyereductionmode");

			public static final Tag Tag_Flashfiredautomodereturnlightdetectedredeyereductionmode = Exif
					.createTag(0x005F, "Flashfiredautomodereturnlightdetectedredeyereductionmode");

		}

		public interface SensingMethod {

			public static final Tag Tag_Notdefined = Exif.createTag(1, "Notdefined");

			public static final Tag Tag_Onechipcolorareasensor = Exif.createTag(2, "Onechipcolorareasensor");

			public static final Tag Tag_Twochipcolorareasensor = Exif.createTag(3, "Twochipcolorareasensor");

			public static final Tag Tag_Threechipcolorareasensor = Exif.createTag(4, "Threechipcolorareasensor");

			public static final Tag Tag_Colorsequentialareasensor = Exif.createTag(5, "Colorsequentialareasensor");

			public static final Tag Tag_Trilinearsensor = Exif.createTag(7, "Trilinearsensor");

			public static final Tag Tag_Colorsequentiallinearsensor = Exif.createTag(8, "Colorsequentiallinearsensor");

		}

		public interface SceneCaptureType {

			public static final Tag Tag_Standard = Exif.createTag(0, "Standard");

			public static final Tag Tag_Landscape = Exif.createTag(1, "Landscape");

			public static final Tag Tag_Portrait = Exif.createTag(2, "Portrait");

			public static final Tag Tag_Nightscene = Exif.createTag(3, "Nightscene");

		}

		public interface SceneType {

			public static final Tag Tag_Directlyphotographed = Exif.createTag(1, "Directlyphotographed");

		}

		public interface CustomRendered {

			public static final Tag Tag_Normalprocess = Exif.createTag(0, "Normalprocess");

			public static final Tag Tag_Customprocess = Exif.createTag(1, "Customprocess");

		}

		public interface WhiteBalance {

			public static final Tag Tag_Autowhitebalance = Exif.createTag(0, "Autowhitebalance");

			public static final Tag Tag_Manualwhitebalance = Exif.createTag(1, "Manualwhitebalance");

		}

		public interface GainControl {

			public static final Tag Tag_None = Exif.createTag(0, "None");

			public static final Tag Tag_Lowgainup = Exif.createTag(1, "Lowgainup");

			public static final Tag Tag_Highgainup = Exif.createTag(2, "Highgainup");

			public static final Tag Tag_Lowgaindown = Exif.createTag(3, "Lowgaindown");

			public static final Tag Tag_Highgaindown = Exif.createTag(4, "Highgaindown");

		}

		public interface Contrast {

			public static final Tag Tag_Normal = Exif.createTag(0, "Normal");

			public static final Tag Tag_Soft = Exif.createTag(1, "Soft");

			public static final Tag Tag_Hard = Exif.createTag(2, "Hard");

		}

		public interface Saturation {

			public static final Tag Tag_Normal = Exif.createTag(0, "Normal");

			public static final Tag Tag_Lowsaturation = Exif.createTag(1, "Lowsaturation");

			public static final Tag Tag_Highsaturation = Exif.createTag(2, "Highsaturation");

		}

		public interface Sharpness {

			public static final Tag Tag_Normal = Exif.createTag(0, "Normal");

			public static final Tag Tag_Soft = Exif.createTag(1, "Soft");

			public static final Tag Tag_Hard = Exif.createTag(2, "Hard");

		}

		public interface SubjectDistanceRange {

			public static final Tag Tag_Unknown = Exif.createTag(0, "Unknown");

			public static final Tag Tag_Macro = Exif.createTag(1, "Macro");

			public static final Tag Tag_Closeview = Exif.createTag(2, "Closeview");

			public static final Tag Tag_Distantview = Exif.createTag(3, "Distantview");

		}

		public interface FileSource {

			public static final Tag Tag_DSC = Exif.createTag(3, "DSC");

		}

		public interface Components {

			public static final Tag Tag_ = Exif.createTag(0, "");

			public static final Tag Tag_Y = Exif.createTag(1, "Y");

			public static final Tag Tag_Cb = Exif.createTag(2, "Cb");

			public static final Tag Tag_Cr = Exif.createTag(3, "Cr");

			public static final Tag Tag_R = Exif.createTag(4, "R");

			public static final Tag Tag_G = Exif.createTag(5, "G");

			public static final Tag Tag_B = Exif.createTag(6, "B");

		}

	}

}

 

© 著作权归作者所有

共有 人打赏支持
IamOkay
粉丝 190
博文 461
码字总数 373670
作品 0
海淀
程序员
私信 提问
Imagero 4.56 发布,Java 图像处理库

Imagero 4.56 发布,该版本重新了很多模块,目的是为了使用 Java 新的特性,例如泛型和枚举,可使用 XMPCollection 轻松创建和修改 XMP 元数据,获取 XMP 数据并返回 TreeModel,修复了 PDF ...

红薯
2012/03/18
3K
2
Imagero 4.43 发布,Java 图像处理库

Java 图像处理库 Imagero 4.43 发布。该版本的变化主要涉及TIFF。具体如下: Support for writing tiled TIFF files was added. The possibility to read a single strip or tile from a TI......

小卒过河
2011/05/25
1K
0
Imagero 3.99 发布-Java图像处理类库

Imagero 是 Java 的图像处理库,支持的图像类型包括:BMP, GIF, TIFF, PNG, JNG, MNG, JPEG (including CMYK and 12-bit grey), PSD, PBM, PGM, PPM, TGA, EPS, EPSI, EPSF, AI, PDF, MRW, C......

红薯
2010/08/03
461
0
Imagero 4.20 发布,Java图像处理库

该版本实现了PDF页和AI图像的渲染,修复了一些bug。 Imagero 是 Java 的图像处理库,支持的图像类型包括:BMP, GIF, TIFF, PNG, JNG, MNG, JPEG (including CMYK and 12-bit grey), PSD, PB...

红薯
2010/12/21
391
0
Imagero 4.39 发布,Java图像处理库

Imagero 是 Java 的图像处理库,支持的图像类型包括:BMP, GIF, TIFF, PNG, JNG, MNG, JPEG (including CMYK and 12-bit grey), PSD, PBM, PGM, PPM, TGA, EPS, EPSI, EPSF, AI, PDF, MRW, C......

老枪
2011/03/05
567
0

没有更多内容

加载失败,请刷新页面

加载更多

Java 如何实现线程间通信?

正常情况下,每个子线程完成各自的任务就可以结束了。不过有的时候,我们希望多个线程协同工作来完成某个任务,这时就涉及到了线程间通信了。 本文涉及到的知识点: thread.join(), object....

颖辉小居
41分钟前
3
0
记一次阿里云服务器运行慢排除

公司测试环境用的阿里云服务器+docker部署的,一共跑了14个项目。之前几个月一直OK,最近几天突然很卡很慢。刚开始以为是项目问题,又是扩大内存,又是清减插件,甚至停了一半项目。结果CPU...

李玉长
41分钟前
3
0
统一客服消息返回错误:{"errcode":43004,"errmsg":"require subscribe hint: [9Vv08633952]"}

公众号或者小程序发送客服消息错误: {"errcode":43004,"errmsg":"require subscribe hint: [9Vv08633952]"} 场景:小程序使用公众号的服务消息,推送消息,如果接收人没有关注公众号,就会出...

tianma3798
53分钟前
1
0
Rainbond V5.0 Beta公测公告

Rainbond支撑企业应用的开发、架构、交付和运维的全流程,通过“无侵入”架构无缝衔接各类企业应用,底层资源可以对接和管理IaaS、虚拟机和物理服务器 Rainbond V5.0即日起开启Beta版本公测,...

好雨云帮
今天
2
0
Word Pattern(leetcode290)

Given a pattern and a string str, find if str follows the same pattern. Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empt......

woshixin
今天
2
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部