📄 exifdirectory.java
字号:
/*
* ExifDirectory.java
*
* This is public domain software - that is, you can do whatever you want
* with it, and include it software that is licensed under the GNU or the
* BSD license, or whatever other licence you choose, including proprietary
* closed source licenses. I do ask that you leave this header in tact.
*
* If you make modifications to this code that you think would benefit the
* wider community, please send me a copy and I'll post it on my site.
*
* If you make use of this code, I'd appreciate hearing about it.
* drew@drewnoakes.com
* Latest version of this software kept at
* http://drewnoakes.com/
*
* Created by dnoakes on 25-Nov-2002 20:41:00 using IntelliJ IDEA.
*/
package com.drew.metadata.exif;
import com.drew.metadata.Directory;
import com.drew.metadata.MetadataException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.HashMap;
/**
*
*/
public class ExifDirectory extends Directory
{
// TODO do these tags belong in the exif directory?
public static final int TAG_SUB_IFDS = 0x014A;
public static final int TAG_GPS_INFO = 0x8825;
/**
* The actual aperture value of lens when the image was taken. Unit is APEX.
* To convert this value to ordinary F-number (F-stop), calculate this value's
* power of root 2 (=1.4142). For example, if the ApertureValue is '5',
* F-number is 1.4142^5 = F5.6.
*/
public static final int TAG_APERTURE = 0x9202;
/**
* When image format is no compression, this value shows the number of bits
* per component for each pixel. Usually this value is '8,8,8'.
*/
public static final int TAG_BITS_PER_SAMPLE = 0x0102;
/**
* Shows compression method for Thumbnail.
* 1 = Uncompressed
* 2 = CCITT 1D
* 3 = T4/Group 3 Fax
* 4 = T6/Group 4 Fax
* 5 = LZW
* 6 = JPEG (old-style)
* 7 = JPEG
* 8 = Adobe Deflate
* 9 = JBIG B&W
* 10 = JBIG Color
* 32766 = Next
* 32771 = CCIRLEW
* 32773 = PackBits
* 32809 = Thunderscan
* 32895 = IT8CTPAD
* 32896 = IT8LW
* 32897 = IT8MP
* 32898 = IT8BL
* 32908 = PixarFilm
* 32909 = PixarLog
* 32946 = Deflate
* 32947 = DCS
* 34661 = JBIG
* 34676 = SGILog
* 34677 = SGILog24
* 34712 = JPEG 2000
* 34713 = Nikon NEF Compressed
*/
public static final int TAG_COMPRESSION = 0x0103;
public static final int COMPRESSION_NONE = 1;
public static final int COMPRESSION_JPEG = 6;
/**
* Shows the color space of the image data components.
* 0 = WhiteIsZero
* 1 = BlackIsZero
* 2 = RGB
* 3 = RGB Palette
* 4 = Transparency Mask
* 5 = CMYK
* 6 = YCbCr
* 8 = CIELab
* 9 = ICCLab
* 10 = ITULab
* 32803 = Color Filter Array
* 32844 = Pixar LogL
* 32845 = Pixar LogLuv
* 34892 = Linear Raw
*/
public static final int TAG_PHOTOMETRIC_INTERPRETATION = 0x0106;
/**
* 1 = No dithering or halftoning
* 2 = Ordered dither or halftone
* 3 = Randomized dither
*/
public static final int TAG_THRESHOLDING = 0x0107;
public static final int PHOTOMETRIC_INTERPRETATION_MONOCHROME = 1;
public static final int PHOTOMETRIC_INTERPRETATION_RGB = 2;
public static final int PHOTOMETRIC_INTERPRETATION_YCBCR = 6;
/** The position in the file of raster data. */
public static final int TAG_STRIP_OFFSETS = 0x0111;
/** Each pixel is composed of this many samples. */
public static final int TAG_SAMPLES_PER_PIXEL = 0x0115;
/** The raster is codified by a single block of data holding this many rows. */
public static final int TAG_ROWS_PER_STRIP = 0x116;
/** The size of the raster data in bytes. */
public static final int TAG_STRIP_BYTE_COUNTS = 0x0117;
public static final int TAG_MIN_SAMPLE_VALUE = 0x0118;
public static final int TAG_MAX_SAMPLE_VALUE = 0x0119;
/**
* When image format is no compression YCbCr, this value shows byte aligns of
* YCbCr data. If value is '1', Y/Cb/Cr value is chunky format, contiguous for
* each subsampling pixel. If value is '2', Y/Cb/Cr value is separated and
* stored to Y plane/Cb plane/Cr plane format.
*/
public static final int TAG_PLANAR_CONFIGURATION = 0x011C;
public static final int TAG_YCBCR_SUBSAMPLING = 0x0212;
public static final int TAG_IMAGE_DESCRIPTION = 0x010E;
public static final int TAG_SOFTWARE = 0x0131;
public static final int TAG_DATETIME = 0x0132;
public static final int TAG_WHITE_POINT = 0x013E;
public static final int TAG_PRIMARY_CHROMATICITIES = 0x013F;
public static final int TAG_YCBCR_COEFFICIENTS = 0x0211;
public static final int TAG_REFERENCE_BLACK_WHITE = 0x0214;
public static final int TAG_COPYRIGHT = 0x8298;
/**
* The new subfile type tag.
* 0 = Full-resolution Image
* 1 = Reduced-resolution image
* 2 = Single page of multi-page image
* 3 = Single page of multi-page reduced-resolution image
* 4 = Transparency mask
* 5 = Transparency mask of reduced-resolution image
* 6 = Transparency mask of multi-page image
* 7 = Transparency mask of reduced-resolution multi-page image
*/
public static final int TAG_NEW_SUBFILE_TYPE = 0x00FE;
/**
* The old subfile type tag.
* 1 = Full-resolution image (Main image)
* 2 = Reduced-resolution image (Thumbnail)
* 3 = Single page of multi-page image
*/
public static final int TAG_SUBFILE_TYPE = 0x00FF;
public static final int TAG_TRANSFER_FUNCTION = 0x012D;
public static final int TAG_ARTIST = 0x013B;
public static final int TAG_PREDICTOR = 0x013D;
public static final int TAG_TILE_WIDTH = 0x0142;
public static final int TAG_TILE_LENGTH = 0x0143;
public static final int TAG_TILE_OFFSETS = 0x0144;
public static final int TAG_TILE_BYTE_COUNTS = 0x0145;
public static final int TAG_JPEG_TABLES = 0x015B;
public static final int TAG_CFA_REPEAT_PATTERN_DIM = 0x828D;
/** There are two definitions for CFA pattern, I don't know the difference... */
public static final int TAG_CFA_PATTERN_2 = 0x828E;
public static final int TAG_BATTERY_LEVEL = 0x828F;
public static final int TAG_IPTC_NAA = 0x83BB;
public static final int TAG_INTER_COLOR_PROFILE = 0x8773;
public static final int TAG_SPECTRAL_SENSITIVITY = 0x8824;
public static final int TAG_OECF = 0x8828;
public static final int TAG_INTERLACE = 0x8829;
public static final int TAG_TIME_ZONE_OFFSET = 0x882A;
public static final int TAG_SELF_TIMER_MODE = 0x882B;
public static final int TAG_FLASH_ENERGY = 0x920B;
public static final int TAG_SPATIAL_FREQ_RESPONSE = 0x920C;
public static final int TAG_NOISE = 0x920D;
public static final int TAG_IMAGE_NUMBER = 0x9211;
public static final int TAG_SECURITY_CLASSIFICATION = 0x9212;
public static final int TAG_IMAGE_HISTORY = 0x9213;
public static final int TAG_SUBJECT_LOCATION = 0x9214;
/** There are two definitions for exposure index, I don't know the difference... */
public static final int TAG_EXPOSURE_INDEX_2 = 0x9215;
public static final int TAG_TIFF_EP_STANDARD_ID = 0x9216;
public static final int TAG_FLASH_ENERGY_2 = 0xA20B;
public static final int TAG_SPATIAL_FREQ_RESPONSE_2 = 0xA20C;
public static final int TAG_SUBJECT_LOCATION_2 = 0xA214;
public static final int TAG_MAKE = 0x010F;
public static final int TAG_MODEL = 0x0110;
public static final int TAG_ORIENTATION = 0x0112;
public static final int TAG_X_RESOLUTION = 0x011A;
public static final int TAG_Y_RESOLUTION = 0x011B;
public static final int TAG_PAGE_NAME = 0x011D;
public static final int TAG_RESOLUTION_UNIT = 0x0128;
public static final int TAG_THUMBNAIL_OFFSET = 0x0201;
public static final int TAG_THUMBNAIL_LENGTH = 0x0202;
public static final int TAG_YCBCR_POSITIONING = 0x0213;
/**
* Exposure time (reciprocal of shutter speed). Unit is second.
*/
public static final int TAG_EXPOSURE_TIME = 0x829A;
/**
* The actual F-number(F-stop) of lens when the image was taken.
*/
public static final int TAG_FNUMBER = 0x829D;
/**
* Exposure program that the camera used when image was taken. '1' means
* manual control, '2' program normal, '3' aperture priority, '4' shutter
* priority, '5' program creative (slow program), '6' program action
* (high-speed program), '7' portrait mode, '8' landscape mode.
*/
public static final int TAG_EXPOSURE_PROGRAM = 0x8822;
public static final int TAG_ISO_EQUIVALENT = 0x8827;
public static final int TAG_EXIF_VERSION = 0x9000;
public static final int TAG_DATETIME_ORIGINAL = 0x9003;
public static final int TAG_DATETIME_DIGITIZED = 0x9004;
public static final int TAG_COMPONENTS_CONFIGURATION = 0x9101;
/**
* Average (rough estimate) compression level in JPEG bits per pixel.
* */
public static final int TAG_COMPRESSION_LEVEL = 0x9102;
/**
* Shutter speed by APEX value. To convert this value to ordinary 'Shutter Speed';
* calculate this value's power of 2, then reciprocal. For example, if the
* ShutterSpeedValue is '4', shutter speed is 1/(24)=1/16 second.
*/
public static final int TAG_SHUTTER_SPEED = 0x9201;
public static final int TAG_BRIGHTNESS_VALUE = 0x9203;
public static final int TAG_EXPOSURE_BIAS = 0x9204;
/**
* Maximum aperture value of lens. You can convert to F-number by calculating
* power of root 2 (same process of ApertureValue:0x9202).
* The actual aperture value of lens when the image was taken. To convert this
* value to ordinary f-number(f-stop), calculate the value's power of root 2
* (=1.4142). For example, if the ApertureValue is '5', f-number is 1.41425^5 = F5.6.
*/
public static final int TAG_MAX_APERTURE = 0x9205;
/**
* Indicates the distance the autofocus camera is focused to. Tends to be less accurate as distance increases.
*/
public static final int TAG_SUBJECT_DISTANCE = 0x9206;
/**
* Exposure metering method. '0' means unknown, '1' average, '2' center
* weighted average, '3' spot, '4' multi-spot, '5' multi-segment, '6' partial,
* '255' other.
*/
public static final int TAG_METERING_MODE = 0x9207;
public static final int TAG_LIGHT_SOURCE = 0x9208;
/**
* White balance (aka light source). '0' means unknown, '1' daylight,
* '2' fluorescent, '3' tungsten, '10' flash, '17' standard light A,
* '18' standard light B, '19' standard light C, '20' D55, '21' D65,
* '22' D75, '255' other.
*/
public static final int TAG_WHITE_BALANCE = 0x9208;
/**
* 0x0 = 0000000 = No Flash
* 0x1 = 0000001 = Fired
* 0x5 = 0000101 = Fired, Return not detected
* 0x7 = 0000111 = Fired, Return detected
* 0x9 = 0001001 = On
* 0xd = 0001101 = On, Return not detected
* 0xf = 0001111 = On, Return detected
* 0x10 = 0010000 = Off
* 0x18 = 0011000 = Auto, Did not fire
* 0x19 = 0011001 = Auto, Fired
* 0x1d = 0011101 = Auto, Fired, Return not detected
* 0x1f = 0011111 = Auto, Fired, Return detected
* 0x20 = 0100000 = No flash function
* 0x41 = 1000001 = Fired, Red-eye reduction
* 0x45 = 1000101 = Fired, Red-eye reduction, Return not detected
* 0x47 = 1000111 = Fired, Red-eye reduction, Return detected
* 0x49 = 1001001 = On, Red-eye reduction
* 0x4d = 1001101 = On, Red-eye reduction, Return not detected
* 0x4f = 1001111 = On, Red-eye reduction, Return detected
* 0x59 = 1011001 = Auto, Fired, Red-eye reduction
* 0x5d = 1011101 = Auto, Fired, Red-eye reduction, Return not detected
* 0x5f = 1011111 = Auto, Fired, Red-eye reduction, Return detected
* 6543210 (positions)
*
* This is a bitmask.
* 0 = flash fired
* 1 = return detected
* 2 = return able to be detected
* 3 = unknown
* 4 = auto used
* 5 = unknown
* 6 = red eye reduction used
*/
public static final int TAG_FLASH = 0x9209;
/**
* Focal length of lens used to take image. Unit is millimeter.
* Nice digital cameras actually save the focal length as a function of how far they are zoomed in.
*/
public static final int TAG_FOCAL_LENGTH = 0x920A;
public static final int TAG_USER_COMMENT = 0x9286;
public static final int TAG_SUBSECOND_TIME = 0x9290;
public static final int TAG_SUBSECOND_TIME_ORIGINAL = 0x9291;
public static final int TAG_SUBSECOND_TIME_DIGITIZED = 0x9292;
public static final int TAG_FLASHPIX_VERSION = 0xA000;
/**
* Defines Color Space. DCF image must use sRGB color space so value is
* always '1'. If the picture uses the other color space, value is
* '65535':Uncalibrated.
*/
public static final int TAG_COLOR_SPACE = 0xA001;
public static final int TAG_EXIF_IMAGE_WIDTH = 0xA002;
public static final int TAG_EXIF_IMAGE_HEIGHT = 0xA003;
public static final int TAG_RELATED_SOUND_FILE = 0xA004;
public static final int TAG_FOCAL_PLANE_X_RES = 0xA20E;
public static final int TAG_FOCAL_PLANE_Y_RES = 0xA20F;
/**
* Unit of FocalPlaneXResoluton/FocalPlaneYResolution. '1' means no-unit,
* '2' inch, '3' centimeter.
*
* Note: Some of Fujifilm's digicam(e.g.FX2700,FX2900,Finepix4700Z/40i etc)
* uses value '3' so it must be 'centimeter', but it seems that they use a
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -