Skip to content

Instantly share code, notes, and snippets.

@douglasgoodwin
Last active August 30, 2019 05:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save douglasgoodwin/9c447216d709ad4614cd33c235a06bb6 to your computer and use it in GitHub Desktop.
Save douglasgoodwin/9c447216d709ad4614cd33c235a06bb6 to your computer and use it in GitHub Desktop.
Let's use a Python module to investigate the metadata of an image file
# What about the file's metadata?
import exifread
imgpath = "IMG_9590_original.jpg"
f = open(imgpath, 'rb')
# Return Exif tags
tags = exifread.process_file(f)
print(tags)
{'Image Make': (0x010F) ASCII=Apple @ 134,
'Image Model': (0x0110) ASCII=iPhone SE @ 140,
'Image Orientation': (0x0112) Short=Horizontal (normal) @ 42,
'Image XResolution': (0x011A) Ratio=72 @ 150,
'Image YResolution': (0x011B) Ratio=72 @ 158,
'Image ResolutionUnit': (0x0128) Short=Pixels/Inch @ 78,
'Image Software': (0x0131) ASCII=12.3.1 @ 166,
'Image DateTime': (0x0132) ASCII=2019:08:29 06:17:22 @ 174,
'Image ExifOffset': (0x8769) Long=194 @ 114,
'GPS GPSLatitudeRef': (0x0001) ASCII=N @ 1740,
'GPS GPSLatitude': (0x0002) Ratio=[34, 6, 3589/100] @ 1916,
'GPS GPSLongitudeRef': (0x0003) ASCII=W @ 1764,
'GPS GPSLongitude': (0x0004) Ratio=[118, 16, 831/100] @ 1940,
'GPS GPSAltitudeRef': (0x0005) Byte=0 @ 1788,
'GPS GPSAltitude': (0x0006) Ratio=31505/209 @ 1964,
'GPS GPSTimeStamp': (0x0007) Ratio=[13, 17, 11] @ 1972,
'GPS GPSSpeedRef': (0x000C) ASCII=K @ 1824,
'GPS GPSSpeed': (0x000D) Ratio=0 @ 1996,
'GPS GPSImgDirectionRef': (0x0010) ASCII=M @ 1848,
'GPS GPSImgDirection': (0x0011) Ratio=22909/242 @ 2004,
'GPS GPSDestBearingRef': (0x0017) ASCII=M @ 1872,
'GPS GPSDestBearing': (0x0018) Ratio=22909/242 @ 2012,
'GPS GPSDate': (0x001D) ASCII=2019:08:29 @ 2020,
'GPS Tag 0x001F': (0x001F) Ratio=65 @ 2032,
'Image GPSInfo': (0x8825) Long=1730 @ 126,
'EXIF ExposureTime': (0x829A) Ratio=1/30 @ 584,
'EXIF FNumber': (0x829D) Ratio=11/5 @ 592,
'EXIF ExposureProgram': (0x8822) Short=Program Normal @ 228,
'EXIF ISOSpeedRatings': (0x8827) Short=64 @ 240,
'EXIF ExifVersion': (0x9000) Undefined=0221 @ 252,
'EXIF DateTimeOriginal': (0x9003) ASCII=2019:08:29 06:17:22 @ 600,
'EXIF DateTimeDigitized': (0x9004) ASCII=2019:08:29 06:17:22 @ 620,
'EXIF ComponentsConfiguration': (0x9101) Undefined=YCbCr @ 288,
'EXIF ShutterSpeedValue': (0x9201) Signed Ratio=7650/1559 @ 640,
'EXIF ApertureValue': (0x9202) Ratio=7983/3509 @ 648,
'EXIF BrightnessValue': (0x9203) Signed Ratio=4909/1386 @ 656,
'EXIF ExposureBiasValue': (0x9204) Signed Ratio=0 @ 664,
'EXIF MeteringMode': (0x9207) Short=Pattern @ 348,
'EXIF Flash': (0x9209) Short=Flash did not fire, auto mode @ 360,
'EXIF FocalLength': (0x920A) Ratio=83/20 @ 672,
'EXIF SubjectArea': (0x9214) Short=[2015, 1511, 2217, 1330] @ 680,
'EXIF MakerNote': (0x927C) Undefined=[65, 112, 112, 108, 101, 32, 105, 79, 83, 0, 0, 1, 77, 77, 0, 18, 0, 1, 0, 9, ... ] @ 688,
'EXIF SubSecTimeOriginal': (0x9291) ASCII=162 @ 408,
'EXIF SubSecTimeDigitized': (0x9292) ASCII=162 @ 420,
'EXIF FlashPixVersion': (0xA000) Undefined=0100 @ 432,
'EXIF ColorSpace': (0xA001) Short=sRGB @ 444,
'EXIF ExifImageWidth': (0xA002) Long=3024 @ 456,
'EXIF ExifImageLength': (0xA003) Long=4032 @ 468,
'EXIF SensingMethod': (0xA217) Short=One-chip color area @ 480,
'EXIF SceneType': (0xA301) Undefined=Directly Photographed @ 492,
'EXIF ExposureMode': (0xA402) Short=Auto Exposure @ 504,
'EXIF WhiteBalance': (0xA403) Short=Auto @ 516,
'EXIF FocalLengthIn35mmFilm': (0xA405) Short=29 @ 528,
'EXIF SceneCaptureType': (0xA406) Short=Standard @ 540,
'EXIF LensSpecification': (0xA432) Ratio=[83/20, 83/20, 11/5, 11/5] @ 1656,
'EXIF LensMake': (0xA433) ASCII=Apple @ 1688,
'EXIF LensModel': (0xA434) ASCII=iPhone SE back camera 4.15mm f/2.2 @ 1694,
'MakerNote Tag 0x0001': (0x0001) Signed Long=10 @ 10,
'MakerNote Tag 0x0002': (0x0002) Undefined=[15, 1, 13, 1, 9, 1, 7, 1, 4, 1, 255, 0, 254, 0, 239, 0, 226, 0, 239, 0, ... ] @ 236,
'MakerNote Tag 0x0003': (0x0003) Undefined=[6, 7, 8, 85, 102, 108, 97, 103, 115, 85, 118, 97, 108, 117, 101, 89, 116, 105, 109, 101, ... ] @ 794,
'MakerNote Tag 0x0004': (0x0004) Signed Long=1 @ 46,
'MakerNote Tag 0x0005': (0x0005) Signed Long=236 @ 58,
'MakerNote Tag 0x0006': (0x0006) Signed Long=228 @ 70,
'MakerNote Tag 0x0007': (0x0007) Signed Long=1 @ 82,
'MakerNote Tag 0x0008': (0x0008) Signed Ratio=[1568407551/-293797888, 148152731/472062498, 909454658/960575789] @ 898,
'MakerNote Tag 0x0009': (0x0009) Signed Long=4371 @ 106,
'MakerNote Tag 0x000E': (0x000E) Signed Long=0 @ 118,
'MakerNote Tag 0x0011': (0x0011) ASCII=4181-B6BA-AE7DD45ECC72 @ 922,
'MakerNote Tag 0x0014': (0x0014) Signed Long=4 @ 142,
'MakerNote Tag 0x0017': (0x0017) Signed Long=0 @ 154,
'MakerNote Tag 0x0019': (0x0019) Signed Long=0 @ 166,
'MakerNote Tag 0x001F': (0x001F) Signed Long=0 @ 178,
'MakerNote Tag 0x0025': (0x0025) Signed Long=0 @ 190,
'MakerNote Tag 0x0026': (0x0026) Signed Long=0 @ 202,
'MakerNote Tag 0x0027': (0x0027) Signed Ratio=20/83 @ 960}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment