diff --git a/doc/changes.rst b/doc/changes.rst index 12a06f7..b89a556 100644 --- a/doc/changes.rst +++ b/doc/changes.rst @@ -1,6 +1,15 @@ Changelog ========= +Unreleased +---------- + +- Added new ``TAG`` with code ``-1`` and name ``_errors`` to prevent some + exceptions during parse of corrupted EXIF. +- Fixed exception in ``_ExifReader.get_ifd_dict()`` method during parse of EXIF + with invalid IFD pointers. Instead, the method returns dictionary with + ``_errors`` key that has description of error. + 1.1.3 ----- diff --git a/piexif/_exif.py b/piexif/_exif.py index abdf0bc..9baddea 100644 --- a/piexif/_exif.py +++ b/piexif/_exif.py @@ -14,307 +14,319 @@ class TYPES: TAGS = { - 'Image': {11: {'name': 'ProcessingSoftware', 'type': TYPES.Ascii}, - 254: {'name': 'NewSubfileType', 'type': TYPES.Long}, - 255: {'name': 'SubfileType', 'type': TYPES.Short}, - 256: {'name': 'ImageWidth', 'type': TYPES.Long}, - 257: {'name': 'ImageLength', 'type': TYPES.Long}, - 258: {'name': 'BitsPerSample', 'type': TYPES.Short}, - 259: {'name': 'Compression', 'type': TYPES.Short}, - 262: {'name': 'PhotometricInterpretation', 'type': TYPES.Short}, - 263: {'name': 'Threshholding', 'type': TYPES.Short}, - 264: {'name': 'CellWidth', 'type': TYPES.Short}, - 265: {'name': 'CellLength', 'type': TYPES.Short}, - 266: {'name': 'FillOrder', 'type': TYPES.Short}, - 269: {'name': 'DocumentName', 'type': TYPES.Ascii}, - 270: {'name': 'ImageDescription', 'type': TYPES.Ascii}, - 271: {'name': 'Make', 'type': TYPES.Ascii}, - 272: {'name': 'Model', 'type': TYPES.Ascii}, - 273: {'name': 'StripOffsets', 'type': TYPES.Long}, - 274: {'name': 'Orientation', 'type': TYPES.Short}, - 277: {'name': 'SamplesPerPixel', 'type': TYPES.Short}, - 278: {'name': 'RowsPerStrip', 'type': TYPES.Long}, - 279: {'name': 'StripByteCounts', 'type': TYPES.Long}, - 282: {'name': 'XResolution', 'type': TYPES.Rational}, - 283: {'name': 'YResolution', 'type': TYPES.Rational}, - 284: {'name': 'PlanarConfiguration', 'type': TYPES.Short}, - 290: {'name': 'GrayResponseUnit', 'type': TYPES.Short}, - 291: {'name': 'GrayResponseCurve', 'type': TYPES.Short}, - 292: {'name': 'T4Options', 'type': TYPES.Long}, - 293: {'name': 'T6Options', 'type': TYPES.Long}, - 296: {'name': 'ResolutionUnit', 'type': TYPES.Short}, - 301: {'name': 'TransferFunction', 'type': TYPES.Short}, - 305: {'name': 'Software', 'type': TYPES.Ascii}, - 306: {'name': 'DateTime', 'type': TYPES.Ascii}, - 315: {'name': 'Artist', 'type': TYPES.Ascii}, - 316: {'name': 'HostComputer', 'type': TYPES.Ascii}, - 317: {'name': 'Predictor', 'type': TYPES.Short}, - 318: {'name': 'WhitePoint', 'type': TYPES.Rational}, - 319: {'name': 'PrimaryChromaticities', 'type': TYPES.Rational}, - 320: {'name': 'ColorMap', 'type': TYPES.Short}, - 321: {'name': 'HalftoneHints', 'type': TYPES.Short}, - 322: {'name': 'TileWidth', 'type': TYPES.Short}, - 323: {'name': 'TileLength', 'type': TYPES.Short}, - 324: {'name': 'TileOffsets', 'type': TYPES.Short}, - 325: {'name': 'TileByteCounts', 'type': TYPES.Short}, - 330: {'name': 'SubIFDs', 'type': TYPES.Long}, - 332: {'name': 'InkSet', 'type': TYPES.Short}, - 333: {'name': 'InkNames', 'type': TYPES.Ascii}, - 334: {'name': 'NumberOfInks', 'type': TYPES.Short}, - 336: {'name': 'DotRange', 'type': TYPES.Byte}, - 337: {'name': 'TargetPrinter', 'type': TYPES.Ascii}, - 338: {'name': 'ExtraSamples', 'type': TYPES.Short}, - 339: {'name': 'SampleFormat', 'type': TYPES.Short}, - 340: {'name': 'SMinSampleValue', 'type': TYPES.Short}, - 341: {'name': 'SMaxSampleValue', 'type': TYPES.Short}, - 342: {'name': 'TransferRange', 'type': TYPES.Short}, - 343: {'name': 'ClipPath', 'type': TYPES.Byte}, - 344: {'name': 'XClipPathUnits', 'type': TYPES.Long}, - 345: {'name': 'YClipPathUnits', 'type': TYPES.Long}, - 346: {'name': 'Indexed', 'type': TYPES.Short}, - 347: {'name': 'JPEGTables', 'type': TYPES.Undefined}, - 351: {'name': 'OPIProxy', 'type': TYPES.Short}, - 512: {'name': 'JPEGProc', 'type': TYPES.Long}, - 513: {'name': 'JPEGInterchangeFormat', 'type': TYPES.Long}, - 514: {'name': 'JPEGInterchangeFormatLength', 'type': TYPES.Long}, - 515: {'name': 'JPEGRestartInterval', 'type': TYPES.Short}, - 517: {'name': 'JPEGLosslessPredictors', 'type': TYPES.Short}, - 518: {'name': 'JPEGPointTransforms', 'type': TYPES.Short}, - 519: {'name': 'JPEGQTables', 'type': TYPES.Long}, - 520: {'name': 'JPEGDCTables', 'type': TYPES.Long}, - 521: {'name': 'JPEGACTables', 'type': TYPES.Long}, - 529: {'name': 'YCbCrCoefficients', 'type': TYPES.Rational}, - 530: {'name': 'YCbCrSubSampling', 'type': TYPES.Short}, - 531: {'name': 'YCbCrPositioning', 'type': TYPES.Short}, - 532: {'name': 'ReferenceBlackWhite', 'type': TYPES.Rational}, - 700: {'name': 'XMLPacket', 'type': TYPES.Byte}, - 18246: {'name': 'Rating', 'type': TYPES.Short}, - 18249: {'name': 'RatingPercent', 'type': TYPES.Short}, - 32781: {'name': 'ImageID', 'type': TYPES.Ascii}, - 33421: {'name': 'CFARepeatPatternDim', 'type': TYPES.Short}, - 33422: {'name': 'CFAPattern', 'type': TYPES.Byte}, - 33423: {'name': 'BatteryLevel', 'type': TYPES.Rational}, - 33432: {'name': 'Copyright', 'type': TYPES.Ascii}, - 33434: {'name': 'ExposureTime', 'type': TYPES.Rational}, - 34377: {'name': 'ImageResources', 'type': TYPES.Byte}, - 34665: {'name': 'ExifTag', 'type': TYPES.Long}, - 34675: {'name': 'InterColorProfile', 'type': TYPES.Undefined}, - 34853: {'name': 'GPSTag', 'type': TYPES.Long}, - 34857: {'name': 'Interlace', 'type': TYPES.Short}, - 34858: {'name': 'TimeZoneOffset', 'type': TYPES.Long}, - 34859: {'name': 'SelfTimerMode', 'type': TYPES.Short}, - 37387: {'name': 'FlashEnergy', 'type': TYPES.Rational}, - 37388: {'name': 'SpatialFrequencyResponse', 'type': TYPES.Undefined}, - 37389: {'name': 'Noise', 'type': TYPES.Undefined}, - 37390: {'name': 'FocalPlaneXResolution', 'type': TYPES.Rational}, - 37391: {'name': 'FocalPlaneYResolution', 'type': TYPES.Rational}, - 37392: {'name': 'FocalPlaneResolutionUnit', 'type': TYPES.Short}, - 37393: {'name': 'ImageNumber', 'type': TYPES.Long}, - 37394: {'name': 'SecurityClassification', 'type': TYPES.Ascii}, - 37395: {'name': 'ImageHistory', 'type': TYPES.Ascii}, - 37397: {'name': 'ExposureIndex', 'type': TYPES.Rational}, - 37398: {'name': 'TIFFEPStandardID', 'type': TYPES.Byte}, - 37399: {'name': 'SensingMethod', 'type': TYPES.Short}, - 40091: {'name': 'XPTitle', 'type': TYPES.Byte}, - 40092: {'name': 'XPComment', 'type': TYPES.Byte}, - 40093: {'name': 'XPAuthor', 'type': TYPES.Byte}, - 40094: {'name': 'XPKeywords', 'type': TYPES.Byte}, - 40095: {'name': 'XPSubject', 'type': TYPES.Byte}, - 50341: {'name': 'PrintImageMatching', 'type': TYPES.Undefined}, - 50706: {'name': 'DNGVersion', 'type': TYPES.Byte}, - 50707: {'name': 'DNGBackwardVersion', 'type': TYPES.Byte}, - 50708: {'name': 'UniqueCameraModel', 'type': TYPES.Ascii}, - 50709: {'name': 'LocalizedCameraModel', 'type': TYPES.Byte}, - 50710: {'name': 'CFAPlaneColor', 'type': TYPES.Byte}, - 50711: {'name': 'CFALayout', 'type': TYPES.Short}, - 50712: {'name': 'LinearizationTable', 'type': TYPES.Short}, - 50713: {'name': 'BlackLevelRepeatDim', 'type': TYPES.Short}, - 50714: {'name': 'BlackLevel', 'type': TYPES.Rational}, - 50715: {'name': 'BlackLevelDeltaH', 'type': TYPES.SRational}, - 50716: {'name': 'BlackLevelDeltaV', 'type': TYPES.SRational}, - 50717: {'name': 'WhiteLevel', 'type': TYPES.Short}, - 50718: {'name': 'DefaultScale', 'type': TYPES.Rational}, - 50719: {'name': 'DefaultCropOrigin', 'type': TYPES.Short}, - 50720: {'name': 'DefaultCropSize', 'type': TYPES.Short}, - 50721: {'name': 'ColorMatrix1', 'type': TYPES.SRational}, - 50722: {'name': 'ColorMatrix2', 'type': TYPES.SRational}, - 50723: {'name': 'CameraCalibration1', 'type': TYPES.SRational}, - 50724: {'name': 'CameraCalibration2', 'type': TYPES.SRational}, - 50725: {'name': 'ReductionMatrix1', 'type': TYPES.SRational}, - 50726: {'name': 'ReductionMatrix2', 'type': TYPES.SRational}, - 50727: {'name': 'AnalogBalance', 'type': TYPES.Rational}, - 50728: {'name': 'AsShotNeutral', 'type': TYPES.Short}, - 50729: {'name': 'AsShotWhiteXY', 'type': TYPES.Rational}, - 50730: {'name': 'BaselineExposure', 'type': TYPES.SRational}, - 50731: {'name': 'BaselineNoise', 'type': TYPES.Rational}, - 50732: {'name': 'BaselineSharpness', 'type': TYPES.Rational}, - 50733: {'name': 'BayerGreenSplit', 'type': TYPES.Long}, - 50734: {'name': 'LinearResponseLimit', 'type': TYPES.Rational}, - 50735: {'name': 'CameraSerialNumber', 'type': TYPES.Ascii}, - 50736: {'name': 'LensInfo', 'type': TYPES.Rational}, - 50737: {'name': 'ChromaBlurRadius', 'type': TYPES.Rational}, - 50738: {'name': 'AntiAliasStrength', 'type': TYPES.Rational}, - 50739: {'name': 'ShadowScale', 'type': TYPES.SRational}, - 50740: {'name': 'DNGPrivateData', 'type': TYPES.Byte}, - 50741: {'name': 'MakerNoteSafety', 'type': TYPES.Short}, - 50778: {'name': 'CalibrationIlluminant1', 'type': TYPES.Short}, - 50779: {'name': 'CalibrationIlluminant2', 'type': TYPES.Short}, - 50780: {'name': 'BestQualityScale', 'type': TYPES.Rational}, - 50781: {'name': 'RawDataUniqueID', 'type': TYPES.Byte}, - 50827: {'name': 'OriginalRawFileName', 'type': TYPES.Byte}, - 50828: {'name': 'OriginalRawFileData', 'type': TYPES.Undefined}, - 50829: {'name': 'ActiveArea', 'type': TYPES.Short}, - 50830: {'name': 'MaskedAreas', 'type': TYPES.Short}, - 50831: {'name': 'AsShotICCProfile', 'type': TYPES.Undefined}, - 50832: {'name': 'AsShotPreProfileMatrix', 'type': TYPES.SRational}, - 50833: {'name': 'CurrentICCProfile', 'type': TYPES.Undefined}, - 50834: {'name': 'CurrentPreProfileMatrix', 'type': TYPES.SRational}, - 50879: {'name': 'ColorimetricReference', 'type': TYPES.Short}, - 50931: {'name': 'CameraCalibrationSignature', 'type': TYPES.Byte}, - 50932: {'name': 'ProfileCalibrationSignature', 'type': TYPES.Byte}, - 50934: {'name': 'AsShotProfileName', 'type': TYPES.Byte}, - 50935: {'name': 'NoiseReductionApplied', 'type': TYPES.Rational}, - 50936: {'name': 'ProfileName', 'type': TYPES.Byte}, - 50937: {'name': 'ProfileHueSatMapDims', 'type': TYPES.Long}, - 50938: {'name': 'ProfileHueSatMapData1', 'type': TYPES.Float}, - 50939: {'name': 'ProfileHueSatMapData2', 'type': TYPES.Float}, - 50940: {'name': 'ProfileToneCurve', 'type': TYPES.Float}, - 50941: {'name': 'ProfileEmbedPolicy', 'type': TYPES.Long}, - 50942: {'name': 'ProfileCopyright', 'type': TYPES.Byte}, - 50964: {'name': 'ForwardMatrix1', 'type': TYPES.SRational}, - 50965: {'name': 'ForwardMatrix2', 'type': TYPES.SRational}, - 50966: {'name': 'PreviewApplicationName', 'type': TYPES.Byte}, - 50967: {'name': 'PreviewApplicationVersion', 'type': TYPES.Byte}, - 50968: {'name': 'PreviewSettingsName', 'type': TYPES.Byte}, - 50969: {'name': 'PreviewSettingsDigest', 'type': TYPES.Byte}, - 50970: {'name': 'PreviewColorSpace', 'type': TYPES.Long}, - 50971: {'name': 'PreviewDateTime', 'type': TYPES.Ascii}, - 50972: {'name': 'RawImageDigest', 'type': TYPES.Undefined}, - 50973: {'name': 'OriginalRawFileDigest', 'type': TYPES.Undefined}, - 50974: {'name': 'SubTileBlockSize', 'type': TYPES.Long}, - 50975: {'name': 'RowInterleaveFactor', 'type': TYPES.Long}, - 50981: {'name': 'ProfileLookTableDims', 'type': TYPES.Long}, - 50982: {'name': 'ProfileLookTableData', 'type': TYPES.Float}, - 51008: {'name': 'OpcodeList1', 'type': TYPES.Undefined}, - 51009: {'name': 'OpcodeList2', 'type': TYPES.Undefined}, - 51022: {'name': 'OpcodeList3', 'type': TYPES.Undefined}, - 60606: {'name': 'ZZZTestSlong1', 'type': TYPES.SLong}, - 60607: {'name': 'ZZZTestSlong2', 'type': TYPES.SLong}, - 60608: {'name': 'ZZZTestSByte', 'type': TYPES.SByte}, - 60609: {'name': 'ZZZTestSShort', 'type': TYPES.SShort}, - 60610: {'name': 'ZZZTestDFloat', 'type': TYPES.DFloat},}, - 'Exif': {33434: {'name': 'ExposureTime', 'type': TYPES.Rational}, - 33437: {'name': 'FNumber', 'type': TYPES.Rational}, - 34850: {'name': 'ExposureProgram', 'type': TYPES.Short}, - 34852: {'name': 'SpectralSensitivity', 'type': TYPES.Ascii}, - 34855: {'name': 'ISOSpeedRatings', 'type': TYPES.Short}, - 34856: {'name': 'OECF', 'type': TYPES.Undefined}, - 34864: {'name': 'SensitivityType', 'type': TYPES.Short}, - 34865: {'name': 'StandardOutputSensitivity', 'type': TYPES.Long}, - 34866: {'name': 'RecommendedExposureIndex', 'type': TYPES.Long}, - 34867: {'name': 'ISOSpeed', 'type': TYPES.Long}, - 34868: {'name': 'ISOSpeedLatitudeyyy', 'type': TYPES.Long}, - 34869: {'name': 'ISOSpeedLatitudezzz', 'type': TYPES.Long}, - 36864: {'name': 'ExifVersion', 'type': TYPES.Undefined}, - 36867: {'name': 'DateTimeOriginal', 'type': TYPES.Ascii}, - 36868: {'name': 'DateTimeDigitized', 'type': TYPES.Ascii}, - 36880: {'name': 'OffsetTime', 'type': TYPES.Ascii}, - 36881: {'name': 'OffsetTimeOriginal', 'type': TYPES.Ascii}, - 36882: {'name': 'OffsetTimeDigitized', 'type': TYPES.Ascii}, - 37121: {'name': 'ComponentsConfiguration', 'type': TYPES.Undefined}, - 37122: {'name': 'CompressedBitsPerPixel', 'type': TYPES.Rational}, - 37377: {'name': 'ShutterSpeedValue', 'type': TYPES.SRational}, - 37378: {'name': 'ApertureValue', 'type': TYPES.Rational}, - 37379: {'name': 'BrightnessValue', 'type': TYPES.SRational}, - 37380: {'name': 'ExposureBiasValue', 'type': TYPES.SRational}, - 37381: {'name': 'MaxApertureValue', 'type': TYPES.Rational}, - 37382: {'name': 'SubjectDistance', 'type': TYPES.Rational}, - 37383: {'name': 'MeteringMode', 'type': TYPES.Short}, - 37384: {'name': 'LightSource', 'type': TYPES.Short}, - 37385: {'name': 'Flash', 'type': TYPES.Short}, - 37386: {'name': 'FocalLength', 'type': TYPES.Rational}, - 37396: {'name': 'SubjectArea', 'type': TYPES.Short}, - 37500: {'name': 'MakerNote', 'type': TYPES.Undefined}, - 37510: {'name': 'UserComment', 'type': TYPES.Undefined}, - 37520: {'name': 'SubSecTime', 'type': TYPES.Ascii}, - 37521: {'name': 'SubSecTimeOriginal', 'type': TYPES.Ascii}, - 37522: {'name': 'SubSecTimeDigitized', 'type': TYPES.Ascii}, - 37888: {'name': 'Temperature', 'type': TYPES.SRational}, - 37889: {'name': 'Humidity', 'type': TYPES.Rational}, - 37890: {'name': 'Pressure', 'type': TYPES.Rational}, - 37891: {'name': 'WaterDepth', 'type': TYPES.SRational}, - 37892: {'name': 'Acceleration', 'type': TYPES.Rational}, - 37893: {'name': 'CameraElevationAngle', 'type': TYPES.SRational}, - 40960: {'name': 'FlashpixVersion', 'type': TYPES.Undefined}, - 40961: {'name': 'ColorSpace', 'type': TYPES.Short}, - 40962: {'name': 'PixelXDimension', 'type': TYPES.Long}, - 40963: {'name': 'PixelYDimension', 'type': TYPES.Long}, - 40964: {'name': 'RelatedSoundFile', 'type': TYPES.Ascii}, - 40965: {'name': 'InteroperabilityTag', 'type': TYPES.Long}, - 41483: {'name': 'FlashEnergy', 'type': TYPES.Rational}, - 41484: {'name': 'SpatialFrequencyResponse', 'type': TYPES.Undefined}, - 41486: {'name': 'FocalPlaneXResolution', 'type': TYPES.Rational}, - 41487: {'name': 'FocalPlaneYResolution', 'type': TYPES.Rational}, - 41488: {'name': 'FocalPlaneResolutionUnit', 'type': TYPES.Short}, - 41492: {'name': 'SubjectLocation', 'type': TYPES.Short}, - 41493: {'name': 'ExposureIndex', 'type': TYPES.Rational}, - 41495: {'name': 'SensingMethod', 'type': TYPES.Short}, - 41728: {'name': 'FileSource', 'type': TYPES.Undefined}, - 41729: {'name': 'SceneType', 'type': TYPES.Undefined}, - 41730: {'name': 'CFAPattern', 'type': TYPES.Undefined}, - 41985: {'name': 'CustomRendered', 'type': TYPES.Short}, - 41986: {'name': 'ExposureMode', 'type': TYPES.Short}, - 41987: {'name': 'WhiteBalance', 'type': TYPES.Short}, - 41988: {'name': 'DigitalZoomRatio', 'type': TYPES.Rational}, - 41989: {'name': 'FocalLengthIn35mmFilm', 'type': TYPES.Short}, - 41990: {'name': 'SceneCaptureType', 'type': TYPES.Short}, - 41991: {'name': 'GainControl', 'type': TYPES.Short}, - 41992: {'name': 'Contrast', 'type': TYPES.Short}, - 41993: {'name': 'Saturation', 'type': TYPES.Short}, - 41994: {'name': 'Sharpness', 'type': TYPES.Short}, - 41995: {'name': 'DeviceSettingDescription', 'type': TYPES.Undefined}, - 41996: {'name': 'SubjectDistanceRange', 'type': TYPES.Short}, - 42016: {'name': 'ImageUniqueID', 'type': TYPES.Ascii}, - 42032: {'name': 'CameraOwnerName', 'type': TYPES.Ascii}, - 42033: {'name': 'BodySerialNumber', 'type': TYPES.Ascii}, - 42034: {'name': 'LensSpecification', 'type': TYPES.Rational}, - 42035: {'name': 'LensMake', 'type': TYPES.Ascii}, - 42036: {'name': 'LensModel', 'type': TYPES.Ascii}, - 42037: {'name': 'LensSerialNumber', 'type': TYPES.Ascii}, - 42240: {'name': 'Gamma', 'type': TYPES.Rational}}, - 'GPS': {0: {'name': 'GPSVersionID', 'type': TYPES.Byte}, - 1: {'name': 'GPSLatitudeRef', 'type': TYPES.Ascii}, - 2: {'name': 'GPSLatitude', 'type': TYPES.Rational}, - 3: {'name': 'GPSLongitudeRef', 'type': TYPES.Ascii}, - 4: {'name': 'GPSLongitude', 'type': TYPES.Rational}, - 5: {'name': 'GPSAltitudeRef', 'type': TYPES.Byte}, - 6: {'name': 'GPSAltitude', 'type': TYPES.Rational}, - 7: {'name': 'GPSTimeStamp', 'type': TYPES.Rational}, - 8: {'name': 'GPSSatellites', 'type': TYPES.Ascii}, - 9: {'name': 'GPSStatus', 'type': TYPES.Ascii}, - 10: {'name': 'GPSMeasureMode', 'type': TYPES.Ascii}, - 11: {'name': 'GPSDOP', 'type': TYPES.Rational}, - 12: {'name': 'GPSSpeedRef', 'type': TYPES.Ascii}, - 13: {'name': 'GPSSpeed', 'type': TYPES.Rational}, - 14: {'name': 'GPSTrackRef', 'type': TYPES.Ascii}, - 15: {'name': 'GPSTrack', 'type': TYPES.Rational}, - 16: {'name': 'GPSImgDirectionRef', 'type': TYPES.Ascii}, - 17: {'name': 'GPSImgDirection', 'type': TYPES.Rational}, - 18: {'name': 'GPSMapDatum', 'type': TYPES.Ascii}, - 19: {'name': 'GPSDestLatitudeRef', 'type': TYPES.Ascii}, - 20: {'name': 'GPSDestLatitude', 'type': TYPES.Rational}, - 21: {'name': 'GPSDestLongitudeRef', 'type': TYPES.Ascii}, - 22: {'name': 'GPSDestLongitude', 'type': TYPES.Rational}, - 23: {'name': 'GPSDestBearingRef', 'type': TYPES.Ascii}, - 24: {'name': 'GPSDestBearing', 'type': TYPES.Rational}, - 25: {'name': 'GPSDestDistanceRef', 'type': TYPES.Ascii}, - 26: {'name': 'GPSDestDistance', 'type': TYPES.Rational}, - 27: {'name': 'GPSProcessingMethod', 'type': TYPES.Undefined}, - 28: {'name': 'GPSAreaInformation', 'type': TYPES.Undefined}, - 29: {'name': 'GPSDateStamp', 'type': TYPES.Ascii}, - 30: {'name': 'GPSDifferential', 'type': TYPES.Short}, - 31: {'name': 'GPSHPositioningError', 'type': TYPES.Rational}}, - 'Interop': {1: {'name': 'InteroperabilityIndex', 'type': TYPES.Ascii}}, + 'Image': { + -1: {'name': '_errors', 'type': TYPES.Ascii}, + 11: {'name': 'ProcessingSoftware', 'type': TYPES.Ascii}, + 254: {'name': 'NewSubfileType', 'type': TYPES.Long}, + 255: {'name': 'SubfileType', 'type': TYPES.Short}, + 256: {'name': 'ImageWidth', 'type': TYPES.Long}, + 257: {'name': 'ImageLength', 'type': TYPES.Long}, + 258: {'name': 'BitsPerSample', 'type': TYPES.Short}, + 259: {'name': 'Compression', 'type': TYPES.Short}, + 262: {'name': 'PhotometricInterpretation', 'type': TYPES.Short}, + 263: {'name': 'Threshholding', 'type': TYPES.Short}, + 264: {'name': 'CellWidth', 'type': TYPES.Short}, + 265: {'name': 'CellLength', 'type': TYPES.Short}, + 266: {'name': 'FillOrder', 'type': TYPES.Short}, + 269: {'name': 'DocumentName', 'type': TYPES.Ascii}, + 270: {'name': 'ImageDescription', 'type': TYPES.Ascii}, + 271: {'name': 'Make', 'type': TYPES.Ascii}, + 272: {'name': 'Model', 'type': TYPES.Ascii}, + 273: {'name': 'StripOffsets', 'type': TYPES.Long}, + 274: {'name': 'Orientation', 'type': TYPES.Short}, + 277: {'name': 'SamplesPerPixel', 'type': TYPES.Short}, + 278: {'name': 'RowsPerStrip', 'type': TYPES.Long}, + 279: {'name': 'StripByteCounts', 'type': TYPES.Long}, + 282: {'name': 'XResolution', 'type': TYPES.Rational}, + 283: {'name': 'YResolution', 'type': TYPES.Rational}, + 284: {'name': 'PlanarConfiguration', 'type': TYPES.Short}, + 290: {'name': 'GrayResponseUnit', 'type': TYPES.Short}, + 291: {'name': 'GrayResponseCurve', 'type': TYPES.Short}, + 292: {'name': 'T4Options', 'type': TYPES.Long}, + 293: {'name': 'T6Options', 'type': TYPES.Long}, + 296: {'name': 'ResolutionUnit', 'type': TYPES.Short}, + 301: {'name': 'TransferFunction', 'type': TYPES.Short}, + 305: {'name': 'Software', 'type': TYPES.Ascii}, + 306: {'name': 'DateTime', 'type': TYPES.Ascii}, + 315: {'name': 'Artist', 'type': TYPES.Ascii}, + 316: {'name': 'HostComputer', 'type': TYPES.Ascii}, + 317: {'name': 'Predictor', 'type': TYPES.Short}, + 318: {'name': 'WhitePoint', 'type': TYPES.Rational}, + 319: {'name': 'PrimaryChromaticities', 'type': TYPES.Rational}, + 320: {'name': 'ColorMap', 'type': TYPES.Short}, + 321: {'name': 'HalftoneHints', 'type': TYPES.Short}, + 322: {'name': 'TileWidth', 'type': TYPES.Short}, + 323: {'name': 'TileLength', 'type': TYPES.Short}, + 324: {'name': 'TileOffsets', 'type': TYPES.Short}, + 325: {'name': 'TileByteCounts', 'type': TYPES.Short}, + 330: {'name': 'SubIFDs', 'type': TYPES.Long}, + 332: {'name': 'InkSet', 'type': TYPES.Short}, + 333: {'name': 'InkNames', 'type': TYPES.Ascii}, + 334: {'name': 'NumberOfInks', 'type': TYPES.Short}, + 336: {'name': 'DotRange', 'type': TYPES.Byte}, + 337: {'name': 'TargetPrinter', 'type': TYPES.Ascii}, + 338: {'name': 'ExtraSamples', 'type': TYPES.Short}, + 339: {'name': 'SampleFormat', 'type': TYPES.Short}, + 340: {'name': 'SMinSampleValue', 'type': TYPES.Short}, + 341: {'name': 'SMaxSampleValue', 'type': TYPES.Short}, + 342: {'name': 'TransferRange', 'type': TYPES.Short}, + 343: {'name': 'ClipPath', 'type': TYPES.Byte}, + 344: {'name': 'XClipPathUnits', 'type': TYPES.Long}, + 345: {'name': 'YClipPathUnits', 'type': TYPES.Long}, + 346: {'name': 'Indexed', 'type': TYPES.Short}, + 347: {'name': 'JPEGTables', 'type': TYPES.Undefined}, + 351: {'name': 'OPIProxy', 'type': TYPES.Short}, + 512: {'name': 'JPEGProc', 'type': TYPES.Long}, + 513: {'name': 'JPEGInterchangeFormat', 'type': TYPES.Long}, + 514: {'name': 'JPEGInterchangeFormatLength', 'type': TYPES.Long}, + 515: {'name': 'JPEGRestartInterval', 'type': TYPES.Short}, + 517: {'name': 'JPEGLosslessPredictors', 'type': TYPES.Short}, + 518: {'name': 'JPEGPointTransforms', 'type': TYPES.Short}, + 519: {'name': 'JPEGQTables', 'type': TYPES.Long}, + 520: {'name': 'JPEGDCTables', 'type': TYPES.Long}, + 521: {'name': 'JPEGACTables', 'type': TYPES.Long}, + 529: {'name': 'YCbCrCoefficients', 'type': TYPES.Rational}, + 530: {'name': 'YCbCrSubSampling', 'type': TYPES.Short}, + 531: {'name': 'YCbCrPositioning', 'type': TYPES.Short}, + 532: {'name': 'ReferenceBlackWhite', 'type': TYPES.Rational}, + 700: {'name': 'XMLPacket', 'type': TYPES.Byte}, + 18246: {'name': 'Rating', 'type': TYPES.Short}, + 18249: {'name': 'RatingPercent', 'type': TYPES.Short}, + 32781: {'name': 'ImageID', 'type': TYPES.Ascii}, + 33421: {'name': 'CFARepeatPatternDim', 'type': TYPES.Short}, + 33422: {'name': 'CFAPattern', 'type': TYPES.Byte}, + 33423: {'name': 'BatteryLevel', 'type': TYPES.Rational}, + 33432: {'name': 'Copyright', 'type': TYPES.Ascii}, + 33434: {'name': 'ExposureTime', 'type': TYPES.Rational}, + 34377: {'name': 'ImageResources', 'type': TYPES.Byte}, + 34665: {'name': 'ExifTag', 'type': TYPES.Long}, + 34675: {'name': 'InterColorProfile', 'type': TYPES.Undefined}, + 34853: {'name': 'GPSTag', 'type': TYPES.Long}, + 34857: {'name': 'Interlace', 'type': TYPES.Short}, + 34858: {'name': 'TimeZoneOffset', 'type': TYPES.Long}, + 34859: {'name': 'SelfTimerMode', 'type': TYPES.Short}, + 37387: {'name': 'FlashEnergy', 'type': TYPES.Rational}, + 37388: {'name': 'SpatialFrequencyResponse', 'type': TYPES.Undefined}, + 37389: {'name': 'Noise', 'type': TYPES.Undefined}, + 37390: {'name': 'FocalPlaneXResolution', 'type': TYPES.Rational}, + 37391: {'name': 'FocalPlaneYResolution', 'type': TYPES.Rational}, + 37392: {'name': 'FocalPlaneResolutionUnit', 'type': TYPES.Short}, + 37393: {'name': 'ImageNumber', 'type': TYPES.Long}, + 37394: {'name': 'SecurityClassification', 'type': TYPES.Ascii}, + 37395: {'name': 'ImageHistory', 'type': TYPES.Ascii}, + 37397: {'name': 'ExposureIndex', 'type': TYPES.Rational}, + 37398: {'name': 'TIFFEPStandardID', 'type': TYPES.Byte}, + 37399: {'name': 'SensingMethod', 'type': TYPES.Short}, + 40091: {'name': 'XPTitle', 'type': TYPES.Byte}, + 40092: {'name': 'XPComment', 'type': TYPES.Byte}, + 40093: {'name': 'XPAuthor', 'type': TYPES.Byte}, + 40094: {'name': 'XPKeywords', 'type': TYPES.Byte}, + 40095: {'name': 'XPSubject', 'type': TYPES.Byte}, + 50341: {'name': 'PrintImageMatching', 'type': TYPES.Undefined}, + 50706: {'name': 'DNGVersion', 'type': TYPES.Byte}, + 50707: {'name': 'DNGBackwardVersion', 'type': TYPES.Byte}, + 50708: {'name': 'UniqueCameraModel', 'type': TYPES.Ascii}, + 50709: {'name': 'LocalizedCameraModel', 'type': TYPES.Byte}, + 50710: {'name': 'CFAPlaneColor', 'type': TYPES.Byte}, + 50711: {'name': 'CFALayout', 'type': TYPES.Short}, + 50712: {'name': 'LinearizationTable', 'type': TYPES.Short}, + 50713: {'name': 'BlackLevelRepeatDim', 'type': TYPES.Short}, + 50714: {'name': 'BlackLevel', 'type': TYPES.Rational}, + 50715: {'name': 'BlackLevelDeltaH', 'type': TYPES.SRational}, + 50716: {'name': 'BlackLevelDeltaV', 'type': TYPES.SRational}, + 50717: {'name': 'WhiteLevel', 'type': TYPES.Short}, + 50718: {'name': 'DefaultScale', 'type': TYPES.Rational}, + 50719: {'name': 'DefaultCropOrigin', 'type': TYPES.Short}, + 50720: {'name': 'DefaultCropSize', 'type': TYPES.Short}, + 50721: {'name': 'ColorMatrix1', 'type': TYPES.SRational}, + 50722: {'name': 'ColorMatrix2', 'type': TYPES.SRational}, + 50723: {'name': 'CameraCalibration1', 'type': TYPES.SRational}, + 50724: {'name': 'CameraCalibration2', 'type': TYPES.SRational}, + 50725: {'name': 'ReductionMatrix1', 'type': TYPES.SRational}, + 50726: {'name': 'ReductionMatrix2', 'type': TYPES.SRational}, + 50727: {'name': 'AnalogBalance', 'type': TYPES.Rational}, + 50728: {'name': 'AsShotNeutral', 'type': TYPES.Short}, + 50729: {'name': 'AsShotWhiteXY', 'type': TYPES.Rational}, + 50730: {'name': 'BaselineExposure', 'type': TYPES.SRational}, + 50731: {'name': 'BaselineNoise', 'type': TYPES.Rational}, + 50732: {'name': 'BaselineSharpness', 'type': TYPES.Rational}, + 50733: {'name': 'BayerGreenSplit', 'type': TYPES.Long}, + 50734: {'name': 'LinearResponseLimit', 'type': TYPES.Rational}, + 50735: {'name': 'CameraSerialNumber', 'type': TYPES.Ascii}, + 50736: {'name': 'LensInfo', 'type': TYPES.Rational}, + 50737: {'name': 'ChromaBlurRadius', 'type': TYPES.Rational}, + 50738: {'name': 'AntiAliasStrength', 'type': TYPES.Rational}, + 50739: {'name': 'ShadowScale', 'type': TYPES.SRational}, + 50740: {'name': 'DNGPrivateData', 'type': TYPES.Byte}, + 50741: {'name': 'MakerNoteSafety', 'type': TYPES.Short}, + 50778: {'name': 'CalibrationIlluminant1', 'type': TYPES.Short}, + 50779: {'name': 'CalibrationIlluminant2', 'type': TYPES.Short}, + 50780: {'name': 'BestQualityScale', 'type': TYPES.Rational}, + 50781: {'name': 'RawDataUniqueID', 'type': TYPES.Byte}, + 50827: {'name': 'OriginalRawFileName', 'type': TYPES.Byte}, + 50828: {'name': 'OriginalRawFileData', 'type': TYPES.Undefined}, + 50829: {'name': 'ActiveArea', 'type': TYPES.Short}, + 50830: {'name': 'MaskedAreas', 'type': TYPES.Short}, + 50831: {'name': 'AsShotICCProfile', 'type': TYPES.Undefined}, + 50832: {'name': 'AsShotPreProfileMatrix', 'type': TYPES.SRational}, + 50833: {'name': 'CurrentICCProfile', 'type': TYPES.Undefined}, + 50834: {'name': 'CurrentPreProfileMatrix', 'type': TYPES.SRational}, + 50879: {'name': 'ColorimetricReference', 'type': TYPES.Short}, + 50931: {'name': 'CameraCalibrationSignature', 'type': TYPES.Byte}, + 50932: {'name': 'ProfileCalibrationSignature', 'type': TYPES.Byte}, + 50934: {'name': 'AsShotProfileName', 'type': TYPES.Byte}, + 50935: {'name': 'NoiseReductionApplied', 'type': TYPES.Rational}, + 50936: {'name': 'ProfileName', 'type': TYPES.Byte}, + 50937: {'name': 'ProfileHueSatMapDims', 'type': TYPES.Long}, + 50938: {'name': 'ProfileHueSatMapData1', 'type': TYPES.Float}, + 50939: {'name': 'ProfileHueSatMapData2', 'type': TYPES.Float}, + 50940: {'name': 'ProfileToneCurve', 'type': TYPES.Float}, + 50941: {'name': 'ProfileEmbedPolicy', 'type': TYPES.Long}, + 50942: {'name': 'ProfileCopyright', 'type': TYPES.Byte}, + 50964: {'name': 'ForwardMatrix1', 'type': TYPES.SRational}, + 50965: {'name': 'ForwardMatrix2', 'type': TYPES.SRational}, + 50966: {'name': 'PreviewApplicationName', 'type': TYPES.Byte}, + 50967: {'name': 'PreviewApplicationVersion', 'type': TYPES.Byte}, + 50968: {'name': 'PreviewSettingsName', 'type': TYPES.Byte}, + 50969: {'name': 'PreviewSettingsDigest', 'type': TYPES.Byte}, + 50970: {'name': 'PreviewColorSpace', 'type': TYPES.Long}, + 50971: {'name': 'PreviewDateTime', 'type': TYPES.Ascii}, + 50972: {'name': 'RawImageDigest', 'type': TYPES.Undefined}, + 50973: {'name': 'OriginalRawFileDigest', 'type': TYPES.Undefined}, + 50974: {'name': 'SubTileBlockSize', 'type': TYPES.Long}, + 50975: {'name': 'RowInterleaveFactor', 'type': TYPES.Long}, + 50981: {'name': 'ProfileLookTableDims', 'type': TYPES.Long}, + 50982: {'name': 'ProfileLookTableData', 'type': TYPES.Float}, + 51008: {'name': 'OpcodeList1', 'type': TYPES.Undefined}, + 51009: {'name': 'OpcodeList2', 'type': TYPES.Undefined}, + 51022: {'name': 'OpcodeList3', 'type': TYPES.Undefined}, + 60606: {'name': 'ZZZTestSlong1', 'type': TYPES.SLong}, + 60607: {'name': 'ZZZTestSlong2', 'type': TYPES.SLong}, + 60608: {'name': 'ZZZTestSByte', 'type': TYPES.SByte}, + 60609: {'name': 'ZZZTestSShort', 'type': TYPES.SShort}, + 60610: {'name': 'ZZZTestDFloat', 'type': TYPES.DFloat}, + }, + 'Exif': { + -1: {'name': '_errors', 'type': TYPES.Ascii}, + 33434: {'name': 'ExposureTime', 'type': TYPES.Rational}, + 33437: {'name': 'FNumber', 'type': TYPES.Rational}, + 34850: {'name': 'ExposureProgram', 'type': TYPES.Short}, + 34852: {'name': 'SpectralSensitivity', 'type': TYPES.Ascii}, + 34855: {'name': 'ISOSpeedRatings', 'type': TYPES.Short}, + 34856: {'name': 'OECF', 'type': TYPES.Undefined}, + 34864: {'name': 'SensitivityType', 'type': TYPES.Short}, + 34865: {'name': 'StandardOutputSensitivity', 'type': TYPES.Long}, + 34866: {'name': 'RecommendedExposureIndex', 'type': TYPES.Long}, + 34867: {'name': 'ISOSpeed', 'type': TYPES.Long}, + 34868: {'name': 'ISOSpeedLatitudeyyy', 'type': TYPES.Long}, + 34869: {'name': 'ISOSpeedLatitudezzz', 'type': TYPES.Long}, + 36864: {'name': 'ExifVersion', 'type': TYPES.Undefined}, + 36867: {'name': 'DateTimeOriginal', 'type': TYPES.Ascii}, + 36868: {'name': 'DateTimeDigitized', 'type': TYPES.Ascii}, + 36880: {'name': 'OffsetTime', 'type': TYPES.Ascii}, + 36881: {'name': 'OffsetTimeOriginal', 'type': TYPES.Ascii}, + 36882: {'name': 'OffsetTimeDigitized', 'type': TYPES.Ascii}, + 37121: {'name': 'ComponentsConfiguration', 'type': TYPES.Undefined}, + 37122: {'name': 'CompressedBitsPerPixel', 'type': TYPES.Rational}, + 37377: {'name': 'ShutterSpeedValue', 'type': TYPES.SRational}, + 37378: {'name': 'ApertureValue', 'type': TYPES.Rational}, + 37379: {'name': 'BrightnessValue', 'type': TYPES.SRational}, + 37380: {'name': 'ExposureBiasValue', 'type': TYPES.SRational}, + 37381: {'name': 'MaxApertureValue', 'type': TYPES.Rational}, + 37382: {'name': 'SubjectDistance', 'type': TYPES.Rational}, + 37383: {'name': 'MeteringMode', 'type': TYPES.Short}, + 37384: {'name': 'LightSource', 'type': TYPES.Short}, + 37385: {'name': 'Flash', 'type': TYPES.Short}, + 37386: {'name': 'FocalLength', 'type': TYPES.Rational}, + 37396: {'name': 'SubjectArea', 'type': TYPES.Short}, + 37500: {'name': 'MakerNote', 'type': TYPES.Undefined}, + 37510: {'name': 'UserComment', 'type': TYPES.Undefined}, + 37520: {'name': 'SubSecTime', 'type': TYPES.Ascii}, + 37521: {'name': 'SubSecTimeOriginal', 'type': TYPES.Ascii}, + 37522: {'name': 'SubSecTimeDigitized', 'type': TYPES.Ascii}, + 37888: {'name': 'Temperature', 'type': TYPES.SRational}, + 37889: {'name': 'Humidity', 'type': TYPES.Rational}, + 37890: {'name': 'Pressure', 'type': TYPES.Rational}, + 37891: {'name': 'WaterDepth', 'type': TYPES.SRational}, + 37892: {'name': 'Acceleration', 'type': TYPES.Rational}, + 37893: {'name': 'CameraElevationAngle', 'type': TYPES.SRational}, + 40960: {'name': 'FlashpixVersion', 'type': TYPES.Undefined}, + 40961: {'name': 'ColorSpace', 'type': TYPES.Short}, + 40962: {'name': 'PixelXDimension', 'type': TYPES.Long}, + 40963: {'name': 'PixelYDimension', 'type': TYPES.Long}, + 40964: {'name': 'RelatedSoundFile', 'type': TYPES.Ascii}, + 40965: {'name': 'InteroperabilityTag', 'type': TYPES.Long}, + 41483: {'name': 'FlashEnergy', 'type': TYPES.Rational}, + 41484: {'name': 'SpatialFrequencyResponse', 'type': TYPES.Undefined}, + 41486: {'name': 'FocalPlaneXResolution', 'type': TYPES.Rational}, + 41487: {'name': 'FocalPlaneYResolution', 'type': TYPES.Rational}, + 41488: {'name': 'FocalPlaneResolutionUnit', 'type': TYPES.Short}, + 41492: {'name': 'SubjectLocation', 'type': TYPES.Short}, + 41493: {'name': 'ExposureIndex', 'type': TYPES.Rational}, + 41495: {'name': 'SensingMethod', 'type': TYPES.Short}, + 41728: {'name': 'FileSource', 'type': TYPES.Undefined}, + 41729: {'name': 'SceneType', 'type': TYPES.Undefined}, + 41730: {'name': 'CFAPattern', 'type': TYPES.Undefined}, + 41985: {'name': 'CustomRendered', 'type': TYPES.Short}, + 41986: {'name': 'ExposureMode', 'type': TYPES.Short}, + 41987: {'name': 'WhiteBalance', 'type': TYPES.Short}, + 41988: {'name': 'DigitalZoomRatio', 'type': TYPES.Rational}, + 41989: {'name': 'FocalLengthIn35mmFilm', 'type': TYPES.Short}, + 41990: {'name': 'SceneCaptureType', 'type': TYPES.Short}, + 41991: {'name': 'GainControl', 'type': TYPES.Short}, + 41992: {'name': 'Contrast', 'type': TYPES.Short}, + 41993: {'name': 'Saturation', 'type': TYPES.Short}, + 41994: {'name': 'Sharpness', 'type': TYPES.Short}, + 41995: {'name': 'DeviceSettingDescription', 'type': TYPES.Undefined}, + 41996: {'name': 'SubjectDistanceRange', 'type': TYPES.Short}, + 42016: {'name': 'ImageUniqueID', 'type': TYPES.Ascii}, + 42032: {'name': 'CameraOwnerName', 'type': TYPES.Ascii}, + 42033: {'name': 'BodySerialNumber', 'type': TYPES.Ascii}, + 42034: {'name': 'LensSpecification', 'type': TYPES.Rational}, + 42035: {'name': 'LensMake', 'type': TYPES.Ascii}, + 42036: {'name': 'LensModel', 'type': TYPES.Ascii}, + 42037: {'name': 'LensSerialNumber', 'type': TYPES.Ascii}, + 42240: {'name': 'Gamma', 'type': TYPES.Rational}, + }, + 'GPS': { + -1: {'name': '_errors', 'type': TYPES.Ascii}, + 0: {'name': 'GPSVersionID', 'type': TYPES.Byte}, + 1: {'name': 'GPSLatitudeRef', 'type': TYPES.Ascii}, + 2: {'name': 'GPSLatitude', 'type': TYPES.Rational}, + 3: {'name': 'GPSLongitudeRef', 'type': TYPES.Ascii}, + 4: {'name': 'GPSLongitude', 'type': TYPES.Rational}, + 5: {'name': 'GPSAltitudeRef', 'type': TYPES.Byte}, + 6: {'name': 'GPSAltitude', 'type': TYPES.Rational}, + 7: {'name': 'GPSTimeStamp', 'type': TYPES.Rational}, + 8: {'name': 'GPSSatellites', 'type': TYPES.Ascii}, + 9: {'name': 'GPSStatus', 'type': TYPES.Ascii}, + 10: {'name': 'GPSMeasureMode', 'type': TYPES.Ascii}, + 11: {'name': 'GPSDOP', 'type': TYPES.Rational}, + 12: {'name': 'GPSSpeedRef', 'type': TYPES.Ascii}, + 13: {'name': 'GPSSpeed', 'type': TYPES.Rational}, + 14: {'name': 'GPSTrackRef', 'type': TYPES.Ascii}, + 15: {'name': 'GPSTrack', 'type': TYPES.Rational}, + 16: {'name': 'GPSImgDirectionRef', 'type': TYPES.Ascii}, + 17: {'name': 'GPSImgDirection', 'type': TYPES.Rational}, + 18: {'name': 'GPSMapDatum', 'type': TYPES.Ascii}, + 19: {'name': 'GPSDestLatitudeRef', 'type': TYPES.Ascii}, + 20: {'name': 'GPSDestLatitude', 'type': TYPES.Rational}, + 21: {'name': 'GPSDestLongitudeRef', 'type': TYPES.Ascii}, + 22: {'name': 'GPSDestLongitude', 'type': TYPES.Rational}, + 23: {'name': 'GPSDestBearingRef', 'type': TYPES.Ascii}, + 24: {'name': 'GPSDestBearing', 'type': TYPES.Rational}, + 25: {'name': 'GPSDestDistanceRef', 'type': TYPES.Ascii}, + 26: {'name': 'GPSDestDistance', 'type': TYPES.Rational}, + 27: {'name': 'GPSProcessingMethod', 'type': TYPES.Undefined}, + 28: {'name': 'GPSAreaInformation', 'type': TYPES.Undefined}, + 29: {'name': 'GPSDateStamp', 'type': TYPES.Ascii}, + 30: {'name': 'GPSDifferential', 'type': TYPES.Short}, + 31: {'name': 'GPSHPositioningError', 'type': TYPES.Rational}, + }, + 'Interop': { + -1: {'name': '_errors', 'type': TYPES.Ascii}, + 1: {'name': 'InteroperabilityIndex', 'type': TYPES.Ascii}, + }, } TAGS["0th"] = TAGS["Image"] diff --git a/piexif/_load.py b/piexif/_load.py index 6176028..d57b23f 100644 --- a/piexif/_load.py +++ b/piexif/_load.py @@ -105,8 +105,12 @@ def __init__(self, data): def get_ifd_dict(self, pointer, ifd_name, read_unknown=False): ifd_dict = {} - tag_count = struct.unpack(self.endian_mark + "H", - self.tiftag[pointer: pointer+2])[0] + try: + tag_count = struct.unpack(self.endian_mark + "H", + self.tiftag[pointer: pointer + 2])[0] + except struct.error: + return {-1: b'Bad SubDirectory start.'} + offset = pointer + 2 if ifd_name in ["0th", "1st"]: t = "Image" @@ -260,11 +264,11 @@ def convert_value(self, val): def _get_key_name_dict(exif_dict): new_dict = { - "0th":{TAGS["Image"][n]["name"]:value for n, value in exif_dict["0th"].items()}, - "Exif":{TAGS["Exif"][n]["name"]:value for n, value in exif_dict["Exif"].items()}, - "1st":{TAGS["Image"][n]["name"]:value for n, value in exif_dict["1st"].items()}, - "GPS":{TAGS["GPS"][n]["name"]:value for n, value in exif_dict["GPS"].items()}, - "Interop":{TAGS["Interop"][n]["name"]:value for n, value in exif_dict["Interop"].items()}, - "thumbnail":exif_dict["thumbnail"], + ifd_name: { + TAGS[ifd_name][n]["name"]: value + for n, value in exif_dict[ifd_name].items() + } + for ifd_name in ("0th", "Exif", "1st", "GPS", "Interop") } - return new_dict \ No newline at end of file + new_dict["thumbnail"] = exif_dict["thumbnail"] + return new_dict diff --git a/tests/images/bad_exif.bin b/tests/images/bad_exif.bin new file mode 100644 index 0000000..8a7aaf8 Binary files /dev/null and b/tests/images/bad_exif.bin differ diff --git a/tests/s_test.py b/tests/s_test.py index 5d105de..3efdffc 100644 --- a/tests/s_test.py +++ b/tests/s_test.py @@ -26,7 +26,7 @@ # JPEG without APP0 and APP1 segments NOAPP01_FILE = os.path.join("tests", "images", "noapp01.jpg") INPUT_FILE_TIF = os.path.join("tests", "images", "01.tif") - +BAD_EXIF_FILE = os.path.join("tests", "images", "bad_exif.bin") with open(INPUT_FILE1, "rb") as f: I1 = f.read() @@ -560,6 +560,56 @@ def test_insert_fail2(self): with self.assertRaises(ValueError): piexif.insert(exif_bytes, I1, False) + def test_invalid_ifd_pointer(self): + with open(BAD_EXIF_FILE, "rb") as exif_file: + data = exif_file.read() + exif = piexif.load(data, key_is_name=True) + + self.assertEqual(exif['Interop'], { + '_errors': b'Bad SubDirectory start.', + }) + + self.assertTrue( + set( + { + 'ExifVersion': b'0230', + 'PixelXDimension': 5184, + 'PixelYDimension': 3456, + 'DateTimeDigitized': b'2018:06:02 15:56:53', + 'LensModel': b'EF-S24mm f/2.8 STM', + 'DateTimeOriginal': b'2018:06:02 15:56:53', + 'ISOSpeedRatings': 400, + 'ExposureTime': (1, 80), + }.items() + ).issubset(set(exif['Exif'].items())) + ) + + self.assertTrue( + set( + { + 'XResolution': (72, 1), + 'YResolution': (72, 1), + 'ResolutionUnit': 2, + 'Make': b'Canon', + 'DateTime': b'2019:02:06 21:05:32', + 'YCbCrPositioning': 2, + 'Model': b'Canon EOS 700D', + 'Orientation': 0, + }.items() + ).issubset(set(exif['0th'].items())) + ) + + self.assertTrue( + set( + { + 'XResolution': (72, 1), + 'YResolution': (72, 1), + 'ResolutionUnit': 2, + 'Compression': 6 + }.items() + ).issubset(set(exif['1st'].items())) + ) + # ------ def test_print_exif(self): print("\n**********************************************") @@ -1030,7 +1080,7 @@ def test_insert(self): } } exif_bytes = piexif.dump(exif_dict) - + for filename in files: try: Image.open(IMAGE_DIR + filename)