src

Go monorepo.
git clone git://code.dwrz.net/src
Log | Files | Refs

fields.go (10700B)


      1 package exif
      2 
      3 type FieldName string
      4 
      5 // UnknownPrefix is used as the first part of field names for decoded tags for
      6 // which there is no known/supported EXIF field.
      7 const UnknownPrefix = "UnknownTag_"
      8 
      9 // Primary EXIF fields
     10 const (
     11 	ImageWidth                 FieldName = "ImageWidth"
     12 	ImageLength                FieldName = "ImageLength" // Image height called Length by EXIF spec
     13 	BitsPerSample              FieldName = "BitsPerSample"
     14 	Compression                FieldName = "Compression"
     15 	PhotometricInterpretation  FieldName = "PhotometricInterpretation"
     16 	Orientation                FieldName = "Orientation"
     17 	SamplesPerPixel            FieldName = "SamplesPerPixel"
     18 	PlanarConfiguration        FieldName = "PlanarConfiguration"
     19 	YCbCrSubSampling           FieldName = "YCbCrSubSampling"
     20 	YCbCrPositioning           FieldName = "YCbCrPositioning"
     21 	XResolution                FieldName = "XResolution"
     22 	YResolution                FieldName = "YResolution"
     23 	ResolutionUnit             FieldName = "ResolutionUnit"
     24 	DateTime                   FieldName = "DateTime"
     25 	ImageDescription           FieldName = "ImageDescription"
     26 	Make                       FieldName = "Make"
     27 	Model                      FieldName = "Model"
     28 	Software                   FieldName = "Software"
     29 	Artist                     FieldName = "Artist"
     30 	Copyright                  FieldName = "Copyright"
     31 	ExifIFDPointer             FieldName = "ExifIFDPointer"
     32 	GPSInfoIFDPointer          FieldName = "GPSInfoIFDPointer"
     33 	InteroperabilityIFDPointer FieldName = "InteroperabilityIFDPointer"
     34 	ExifVersion                FieldName = "ExifVersion"
     35 	FlashpixVersion            FieldName = "FlashpixVersion"
     36 	ColorSpace                 FieldName = "ColorSpace"
     37 	ComponentsConfiguration    FieldName = "ComponentsConfiguration"
     38 	CompressedBitsPerPixel     FieldName = "CompressedBitsPerPixel"
     39 	PixelXDimension            FieldName = "PixelXDimension"
     40 	PixelYDimension            FieldName = "PixelYDimension"
     41 	MakerNote                  FieldName = "MakerNote"
     42 	UserComment                FieldName = "UserComment"
     43 	RelatedSoundFile           FieldName = "RelatedSoundFile"
     44 	DateTimeOriginal           FieldName = "DateTimeOriginal"
     45 	DateTimeDigitized          FieldName = "DateTimeDigitized"
     46 	SubSecTime                 FieldName = "SubSecTime"
     47 	SubSecTimeOriginal         FieldName = "SubSecTimeOriginal"
     48 	SubSecTimeDigitized        FieldName = "SubSecTimeDigitized"
     49 	ImageUniqueID              FieldName = "ImageUniqueID"
     50 	ExposureTime               FieldName = "ExposureTime"
     51 	FNumber                    FieldName = "FNumber"
     52 	ExposureProgram            FieldName = "ExposureProgram"
     53 	SpectralSensitivity        FieldName = "SpectralSensitivity"
     54 	ISOSpeedRatings            FieldName = "ISOSpeedRatings"
     55 	OECF                       FieldName = "OECF"
     56 	ShutterSpeedValue          FieldName = "ShutterSpeedValue"
     57 	ApertureValue              FieldName = "ApertureValue"
     58 	BrightnessValue            FieldName = "BrightnessValue"
     59 	ExposureBiasValue          FieldName = "ExposureBiasValue"
     60 	MaxApertureValue           FieldName = "MaxApertureValue"
     61 	SubjectDistance            FieldName = "SubjectDistance"
     62 	MeteringMode               FieldName = "MeteringMode"
     63 	LightSource                FieldName = "LightSource"
     64 	Flash                      FieldName = "Flash"
     65 	FocalLength                FieldName = "FocalLength"
     66 	SubjectArea                FieldName = "SubjectArea"
     67 	FlashEnergy                FieldName = "FlashEnergy"
     68 	SpatialFrequencyResponse   FieldName = "SpatialFrequencyResponse"
     69 	FocalPlaneXResolution      FieldName = "FocalPlaneXResolution"
     70 	FocalPlaneYResolution      FieldName = "FocalPlaneYResolution"
     71 	FocalPlaneResolutionUnit   FieldName = "FocalPlaneResolutionUnit"
     72 	SubjectLocation            FieldName = "SubjectLocation"
     73 	ExposureIndex              FieldName = "ExposureIndex"
     74 	SensingMethod              FieldName = "SensingMethod"
     75 	FileSource                 FieldName = "FileSource"
     76 	SceneType                  FieldName = "SceneType"
     77 	CFAPattern                 FieldName = "CFAPattern"
     78 	CustomRendered             FieldName = "CustomRendered"
     79 	ExposureMode               FieldName = "ExposureMode"
     80 	WhiteBalance               FieldName = "WhiteBalance"
     81 	DigitalZoomRatio           FieldName = "DigitalZoomRatio"
     82 	FocalLengthIn35mmFilm      FieldName = "FocalLengthIn35mmFilm"
     83 	SceneCaptureType           FieldName = "SceneCaptureType"
     84 	GainControl                FieldName = "GainControl"
     85 	Contrast                   FieldName = "Contrast"
     86 	Saturation                 FieldName = "Saturation"
     87 	Sharpness                  FieldName = "Sharpness"
     88 	DeviceSettingDescription   FieldName = "DeviceSettingDescription"
     89 	SubjectDistanceRange       FieldName = "SubjectDistanceRange"
     90 	LensMake                   FieldName = "LensMake"
     91 	LensModel                  FieldName = "LensModel"
     92 )
     93 
     94 // Windows-specific tags
     95 const (
     96 	XPTitle    FieldName = "XPTitle"
     97 	XPComment  FieldName = "XPComment"
     98 	XPAuthor   FieldName = "XPAuthor"
     99 	XPKeywords FieldName = "XPKeywords"
    100 	XPSubject  FieldName = "XPSubject"
    101 )
    102 
    103 // thumbnail fields
    104 const (
    105 	ThumbJPEGInterchangeFormat       FieldName = "ThumbJPEGInterchangeFormat"       // offset to thumb jpeg SOI
    106 	ThumbJPEGInterchangeFormatLength FieldName = "ThumbJPEGInterchangeFormatLength" // byte length of thumb
    107 )
    108 
    109 // GPS fields
    110 const (
    111 	GPSVersionID        FieldName = "GPSVersionID"
    112 	GPSLatitudeRef      FieldName = "GPSLatitudeRef"
    113 	GPSLatitude         FieldName = "GPSLatitude"
    114 	GPSLongitudeRef     FieldName = "GPSLongitudeRef"
    115 	GPSLongitude        FieldName = "GPSLongitude"
    116 	GPSAltitudeRef      FieldName = "GPSAltitudeRef"
    117 	GPSAltitude         FieldName = "GPSAltitude"
    118 	GPSTimeStamp        FieldName = "GPSTimeStamp"
    119 	GPSSatelites        FieldName = "GPSSatelites"
    120 	GPSStatus           FieldName = "GPSStatus"
    121 	GPSMeasureMode      FieldName = "GPSMeasureMode"
    122 	GPSDOP              FieldName = "GPSDOP"
    123 	GPSSpeedRef         FieldName = "GPSSpeedRef"
    124 	GPSSpeed            FieldName = "GPSSpeed"
    125 	GPSTrackRef         FieldName = "GPSTrackRef"
    126 	GPSTrack            FieldName = "GPSTrack"
    127 	GPSImgDirectionRef  FieldName = "GPSImgDirectionRef"
    128 	GPSImgDirection     FieldName = "GPSImgDirection"
    129 	GPSMapDatum         FieldName = "GPSMapDatum"
    130 	GPSDestLatitudeRef  FieldName = "GPSDestLatitudeRef"
    131 	GPSDestLatitude     FieldName = "GPSDestLatitude"
    132 	GPSDestLongitudeRef FieldName = "GPSDestLongitudeRef"
    133 	GPSDestLongitude    FieldName = "GPSDestLongitude"
    134 	GPSDestBearingRef   FieldName = "GPSDestBearingRef"
    135 	GPSDestBearing      FieldName = "GPSDestBearing"
    136 	GPSDestDistanceRef  FieldName = "GPSDestDistanceRef"
    137 	GPSDestDistance     FieldName = "GPSDestDistance"
    138 	GPSProcessingMethod FieldName = "GPSProcessingMethod"
    139 	GPSAreaInformation  FieldName = "GPSAreaInformation"
    140 	GPSDateStamp        FieldName = "GPSDateStamp"
    141 	GPSDifferential     FieldName = "GPSDifferential"
    142 )
    143 
    144 // interoperability fields
    145 const (
    146 	InteroperabilityIndex FieldName = "InteroperabilityIndex"
    147 )
    148 
    149 var exifFields = map[uint16]FieldName{
    150 	/////////////////////////////////////
    151 	////////// IFD 0 ////////////////////
    152 	/////////////////////////////////////
    153 
    154 	// image data structure for the thumbnail
    155 	0x0100: ImageWidth,
    156 	0x0101: ImageLength,
    157 	0x0102: BitsPerSample,
    158 	0x0103: Compression,
    159 	0x0106: PhotometricInterpretation,
    160 	0x0112: Orientation,
    161 	0x0115: SamplesPerPixel,
    162 	0x011C: PlanarConfiguration,
    163 	0x0212: YCbCrSubSampling,
    164 	0x0213: YCbCrPositioning,
    165 	0x011A: XResolution,
    166 	0x011B: YResolution,
    167 	0x0128: ResolutionUnit,
    168 
    169 	// Other tags
    170 	0x0132: DateTime,
    171 	0x010E: ImageDescription,
    172 	0x010F: Make,
    173 	0x0110: Model,
    174 	0x0131: Software,
    175 	0x013B: Artist,
    176 	0x8298: Copyright,
    177 
    178 	// Windows-specific tags
    179 	0x9c9b: XPTitle,
    180 	0x9c9c: XPComment,
    181 	0x9c9d: XPAuthor,
    182 	0x9c9e: XPKeywords,
    183 	0x9c9f: XPSubject,
    184 
    185 	// private tags
    186 	exifPointer: ExifIFDPointer,
    187 
    188 	/////////////////////////////////////
    189 	////////// Exif sub IFD /////////////
    190 	/////////////////////////////////////
    191 
    192 	gpsPointer:     GPSInfoIFDPointer,
    193 	interopPointer: InteroperabilityIFDPointer,
    194 
    195 	0x9000: ExifVersion,
    196 	0xA000: FlashpixVersion,
    197 
    198 	0xA001: ColorSpace,
    199 
    200 	0x9101: ComponentsConfiguration,
    201 	0x9102: CompressedBitsPerPixel,
    202 	0xA002: PixelXDimension,
    203 	0xA003: PixelYDimension,
    204 
    205 	0x927C: MakerNote,
    206 	0x9286: UserComment,
    207 
    208 	0xA004: RelatedSoundFile,
    209 	0x9003: DateTimeOriginal,
    210 	0x9004: DateTimeDigitized,
    211 	0x9290: SubSecTime,
    212 	0x9291: SubSecTimeOriginal,
    213 	0x9292: SubSecTimeDigitized,
    214 
    215 	0xA420: ImageUniqueID,
    216 
    217 	// picture conditions
    218 	0x829A: ExposureTime,
    219 	0x829D: FNumber,
    220 	0x8822: ExposureProgram,
    221 	0x8824: SpectralSensitivity,
    222 	0x8827: ISOSpeedRatings,
    223 	0x8828: OECF,
    224 	0x9201: ShutterSpeedValue,
    225 	0x9202: ApertureValue,
    226 	0x9203: BrightnessValue,
    227 	0x9204: ExposureBiasValue,
    228 	0x9205: MaxApertureValue,
    229 	0x9206: SubjectDistance,
    230 	0x9207: MeteringMode,
    231 	0x9208: LightSource,
    232 	0x9209: Flash,
    233 	0x920A: FocalLength,
    234 	0x9214: SubjectArea,
    235 	0xA20B: FlashEnergy,
    236 	0xA20C: SpatialFrequencyResponse,
    237 	0xA20E: FocalPlaneXResolution,
    238 	0xA20F: FocalPlaneYResolution,
    239 	0xA210: FocalPlaneResolutionUnit,
    240 	0xA214: SubjectLocation,
    241 	0xA215: ExposureIndex,
    242 	0xA217: SensingMethod,
    243 	0xA300: FileSource,
    244 	0xA301: SceneType,
    245 	0xA302: CFAPattern,
    246 	0xA401: CustomRendered,
    247 	0xA402: ExposureMode,
    248 	0xA403: WhiteBalance,
    249 	0xA404: DigitalZoomRatio,
    250 	0xA405: FocalLengthIn35mmFilm,
    251 	0xA406: SceneCaptureType,
    252 	0xA407: GainControl,
    253 	0xA408: Contrast,
    254 	0xA409: Saturation,
    255 	0xA40A: Sharpness,
    256 	0xA40B: DeviceSettingDescription,
    257 	0xA40C: SubjectDistanceRange,
    258 	0xA433: LensMake,
    259 	0xA434: LensModel,
    260 }
    261 
    262 var gpsFields = map[uint16]FieldName{
    263 	/////////////////////////////////////
    264 	//// GPS sub-IFD ////////////////////
    265 	/////////////////////////////////////
    266 	0x0:  GPSVersionID,
    267 	0x1:  GPSLatitudeRef,
    268 	0x2:  GPSLatitude,
    269 	0x3:  GPSLongitudeRef,
    270 	0x4:  GPSLongitude,
    271 	0x5:  GPSAltitudeRef,
    272 	0x6:  GPSAltitude,
    273 	0x7:  GPSTimeStamp,
    274 	0x8:  GPSSatelites,
    275 	0x9:  GPSStatus,
    276 	0xA:  GPSMeasureMode,
    277 	0xB:  GPSDOP,
    278 	0xC:  GPSSpeedRef,
    279 	0xD:  GPSSpeed,
    280 	0xE:  GPSTrackRef,
    281 	0xF:  GPSTrack,
    282 	0x10: GPSImgDirectionRef,
    283 	0x11: GPSImgDirection,
    284 	0x12: GPSMapDatum,
    285 	0x13: GPSDestLatitudeRef,
    286 	0x14: GPSDestLatitude,
    287 	0x15: GPSDestLongitudeRef,
    288 	0x16: GPSDestLongitude,
    289 	0x17: GPSDestBearingRef,
    290 	0x18: GPSDestBearing,
    291 	0x19: GPSDestDistanceRef,
    292 	0x1A: GPSDestDistance,
    293 	0x1B: GPSProcessingMethod,
    294 	0x1C: GPSAreaInformation,
    295 	0x1D: GPSDateStamp,
    296 	0x1E: GPSDifferential,
    297 }
    298 
    299 var interopFields = map[uint16]FieldName{
    300 	/////////////////////////////////////
    301 	//// Interoperability sub-IFD ///////
    302 	/////////////////////////////////////
    303 	0x1: InteroperabilityIndex,
    304 }
    305 
    306 var thumbnailFields = map[uint16]FieldName{
    307 	0x0201: ThumbJPEGInterchangeFormat,
    308 	0x0202: ThumbJPEGInterchangeFormatLength,
    309 }