Skip to content

生活篇

Tsung-Jung Tsai (TJ_Tsai) edited this page Mar 22, 2022 · 2 revisions
  • Python实现图片按照拍摄日期进行自动归类
  • 顯示圖片的相關 metadata
    import exifread
    fd = open('IMG_9672.JPG', 'rb')
    metadata = exifread.process_file(fd)
    for k, v in sorted(metadata.items()):
      print(k, '->', v)
    
    fd.close()
    
    EXIF ApertureValue -> 6
    EXIF BodySerialNumber -> 088042001623
    EXIF CameraOwnerName ->
    EXIF ColorSpace -> sRGB
    EXIF ComponentsConfiguration -> YCbCr
    EXIF CustomRendered -> Normal
    EXIF DateTimeDigitized -> 2022:01:12 13:14:44
    EXIF DateTimeOriginal -> 2022:01:12 13:14:44
    EXIF ExifImageLength -> 3456
    EXIF ExifImageWidth -> 5184
    EXIF ExifVersion -> 0230
    EXIF ExposureBiasValue -> 0
    EXIF ExposureMode -> Auto Exposure
    EXIF ExposureProgram -> Landscape Mode
    EXIF ExposureTime -> 1/60
    EXIF FNumber -> 8
    EXIF Flash -> Flash did not fire, compulsory flash mode
    EXIF FlashPixVersion -> 0100
    EXIF FocalLength -> 18
    EXIF FocalPlaneResolutionUnit -> 2
    EXIF FocalPlaneXResolution -> 864000/149
    EXIF FocalPlaneYResolution -> 1152000/199
    EXIF ISOSpeedRatings -> 100
    EXIF InteroperabilityOffset -> 8806
    EXIF LensModel -> EF-S18-55mm f/3.5-5.6 IS II
    EXIF LensSerialNumber -> 000030ea8c
    EXIF LensSpecification -> [18, 55, 0, 0]
    EXIF MakerNote -> [39, 0, 1, 0, 3, 0, 49, 0, 0, 0, 104, 5, 0, 0, 2, 0, 3, 0, 4, 0, ... ]
    EXIF MeteringMode -> Pattern
    EXIF RecommendedExposureIndex -> 100
    EXIF SceneCaptureType -> Standard
    EXIF SensitivityType -> Recommended Exposure Index
    EXIF ShutterSpeedValue -> 6
    EXIF SubSecTime -> 32
    EXIF SubSecTimeDigitized -> 32
    EXIF SubSecTimeOriginal -> 32
    EXIF UserComment -> [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    EXIF WhiteBalance -> Auto
    GPS GPSVersionID -> [2, 3, 0, 0]
    Image Artist ->
    Image Copyright ->
    Image DateTime -> 2022:01:12 13:14:44
    Image ExifOffset -> 360
    Image GPSInfo -> 9034
    Image Make -> Canon
    Image Model -> Canon EOS 650D
    Image Orientation -> Rotated 90 CW
    Image ResolutionUnit -> Pixels/Inch
    Image XResolution -> 72
    Image YCbCrPositioning -> Co-sited
    Image YResolution -> 72
    Interoperability InteroperabilityIndex -> R98
    Interoperability InteroperabilityVersion -> [48, 49, 48, 48]
    JPEGThumbnail -> b'\xff...(binary)...\xd9'
    MakerNote AESetting -> Unknown
    MakerNote AFAreaMode -> Unknown
    MakerNote AFPointSelected -> Unknown
    MakerNote AFPointUsed -> 0
    MakerNote AspectInfo -> [0, 5184, 3456, 0, 0]
    MakerNote BracketMode -> Off
    MakerNote BracketShotNumber -> 0
    MakerNote BracketValue -> 0
    MakerNote CanonImageWidth -> 3456
    MakerNote ColorSpace -> sRGB
    MakerNote ContinuousDriveMode -> Single Or Timer
    MakerNote Contrast -> Normal
    MakerNote CropInfo  -> [0, 0, 0, 0]
    MakerNote DigitalZoom -> None
    MakerNote DustRemovalData  -> []
    MakerNote EasyShootingMode -> Landscape
    MakerNote ExposureMode -> Easy Shooting
    MakerNote FileNumber -> 0
    MakerNote FilterEffect -> Unknown
    MakerNote FirmwareVersion -> Firmware Version 1.0.1
    MakerNote FlashActivity -> Did Not Fire
    MakerNote FlashBias -> 0 EV
    MakerNote FlashDetails -> Manual
    MakerNote FlashExposureLock -> Off
    MakerNote FlashInfo -> [0, 0, 0, 0]
    MakerNote FlashMode -> Flash Not Fired
    MakerNote FocalLength -> 63343
    MakerNote FocalType -> Unknown
    MakerNote FocalUnitsPerMM -> 1
    MakerNote FocusMode -> Unknown
    MakerNote FocusType -> Unknown
    MakerNote ISO -> Auto
    MakerNote ImageSize -> Large
    MakerNote ImageStabilization -> Unknown
    MakerNote ImageType -> Canon EOS 650D
    MakerNote InternalSerialNumber  -> DA0539968
    MakerNote LensModel -> EF-S18-55mm f/3.5-5.6 IS II
    MakerNote LensType -> 52
    MakerNote LiveViewShooting -> Off
    MakerNote LongExposureNoiseReduction2 -> Unknown
    MakerNote LongFocalLengthOfLensInFocalUnits -> 55
    MakerNote MacroMagnification -> 151
    MakerNote Macromode -> Normal
    MakerNote ManualFlashOutput -> n/a
    MakerNote MeteringMode -> Evaluative
    MakerNote ModelID -> EOS Rebel T4i / 650D / Kiss X6i
    MakerNote NumAFPoints -> 9
    MakerNote OwnerName ->
    MakerNote Quality -> Fine
    MakerNote RawJpgQuality -> Unknown
    MakerNote RawJpgSize -> Large
    MakerNote RecordMode -> JPEG
    MakerNote Saturation -> Normal
    MakerNote SelfTimer -> 0
    MakerNote SequenceNumber -> 0
    MakerNote Sharpness -> Unknown
    MakerNote ShortFocalLengthOfLensInFocalUnits -> 18
    MakerNote SlowShutter -> None
    MakerNote SpotMeteringMode -> Unknown
    MakerNote SubjectDistance -> 0
    MakerNote Tag 0x0019 -> 1
    MakerNote Tag 0x0035 -> [16, 480, 7, 0]
    MakerNote Tag 0x0099 -> [152, 4, 1, 32, 2, 257, 1, 0, 259, 1, 0, 2, 20, 1, 515, 1, 0, 3, 32, 2, 1294, 1, 0, 1551, 1, 0, 4, 44, 3, 1793, 1, 0, 1796, 1, 0, 2065, 1, 0]
    MakerNote Tag 0x00A0 -> [28, 0, 3, 0, 0, 0, 0, 0, 65535, 5200, 135, 0, 0, 0]
    MakerNote Tag 0x00AA -> [12, 501, 1024, 1024, 623, 0]
    MakerNote Tag 0x00D0 -> 0
    MakerNote Tag 0x00E0 -> [34, 5280, 3528, 1, 1, 84, 64, 5267, 3519, 0, 0, 0, 0, 0, 0, 0, 0]
    MakerNote Tag 0x4001 -> []
    MakerNote Tag 0x4008 -> [135, 135, 135]
    MakerNote Tag 0x4009 -> [0, 0, 0]
    MakerNote Tag 0x4010 ->
    MakerNote Tag 0x4011 -> [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... ]
    MakerNote Tag 0x4012 ->
    MakerNote Tag 0x4013 -> [44, 0, 0, 10, 4294967295, 0, 10, 0, 10, 0, 10]
    MakerNote Tag 0x4015 -> [0, 32, 196, 1, 1, 0, 0, 0, 0, 0, 0, 0, 70, 0, 0, 0, 0, 0, 0, 0, ... ]
    MakerNote Tag 0x4016 -> [28, 0, 1, 0, 1, 1, 0]
    MakerNote Tag 0x4018 -> [28, 0, 0, 0, 0, 0, 0]
    MakerNote Tag 0x4019 -> [0, 0, 48, 234, 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    MakerNote Tag 0x4020 -> [20, 0, 0, 0, 0]
    MakerNote Tag 0x4025 -> [36, 0, 0, 0, 0, 0, 0, 0, 0]
    MakerNote Tag 0x4027 -> [20, 328969, 2181038120, 117440512, 3158064]
    MakerNote ThumbnailImageValidArea -> [0, 159, 7, 112]
    MakerNote ToningEffect -> Unknown
    MakerNote Unknown -> 65535
    MakerNote ValidAFPoints -> 5184
    MakerNote WBBracketMode -> Off
    MakerNote WBBracketValueAB -> 0
    MakerNote WBBracketValueGM -> 0
    MakerNote WhiteBalance -> Auto
    Thumbnail Compression -> JPEG (old-style)
    Thumbnail JPEGInterchangeFormat -> 10924
    Thumbnail JPEGInterchangeFormatLength -> 18633
    Thumbnail ResolutionUnit -> Pixels/Inch
    Thumbnail XResolution -> 72
    Thumbnail YResolution -> 72
    
Clone this wiki locally