Search code examples
pythonimageexif

Retrieve Image description with Python (not returned in EXIF data via PIL or exifread)


I want to get the description of an .jpg image. It gets shown in the Mac OSx Info (cmd +i) window.

Mac OS Info

I want to read the "description" (Beschreibung in German) field. Trying this with PIL and exifread lead to no success.

I can get these exif Tags, but they do not include the description or keywords.

Key: Image ImageWidth
Key: Image ImageLength
Key: Image Compression
Key: Image Make
Key: Image Model
Key: Image XResolution
Key: Image YResolution
Key: Image PlanarConfiguration
Key: Image ResolutionUnit
Key: Image Software
Key: Image DateTime
Key: Image YCbCrPositioning
Key: Image ExifOffset
Key: Thumbnail Compression
Key: Thumbnail Orientation
Key: Thumbnail XResolution
Key: Thumbnail YResolution
Key: Thumbnail ResolutionUnit
Key: Thumbnail DateTime
Key: Thumbnail JPEGInterchangeFormat
Key: Thumbnail JPEGInterchangeFormatLength
Key: EXIF ExposureTime
Key: EXIF FNumber
Key: EXIF ExposureProgram
Key: EXIF ISOSpeedRatings
Key: EXIF SensitivityType
Key: EXIF ExifVersion
Key: EXIF DateTimeOriginal
Key: EXIF DateTimeDigitized
Key: EXIF ComponentsConfiguration
Key: EXIF ShutterSpeedValue
Key: EXIF ApertureValue
Key: EXIF ExposureBiasValue
Key: EXIF MaxApertureValue
Key: EXIF MeteringMode
Key: EXIF LightSource
Key: EXIF Flash
Key: EXIF FocalLength
Key: EXIF SubSecTimeOriginal
Key: EXIF SubSecTimeDigitized
Key: EXIF ColorSpace
Key: EXIF ExifImageWidth
Key: EXIF ExifImageLength
Key: EXIF FocalPlaneXResolution
Key: EXIF FocalPlaneYResolution
Key: EXIF FocalPlaneResolutionUnit
Key: EXIF SensingMethod
Key: EXIF FileSource
Key: EXIF SceneType
Key: EXIF CVAPattern
Key: EXIF CustomRendered
Key: EXIF ExposureMode
Key: EXIF WhiteBalance
Key: EXIF DigitalZoomRatio
Key: EXIF FocalLengthIn35mmFilm
Key: EXIF SceneCaptureType
Key: EXIF GainControl
Key: EXIF Contrast
Key: EXIF Saturation
Key: EXIF Sharpness
Key: EXIF SubjectDistanceRange
Key: EXIF BodySerialNumber
Key: EXIF LensSpecification
Key: EXIF LensModel

I assume these fields are not EXIF data? What do I need to look for in order to get the description?


Solution

  • Thanks to @Mark Serchells answer, I found that the description is no EXIF data but IPTC data (exiftool shows all the fields).

    In Python I now can use IPTCInfo3: https://pypi.org/project/IPTCInfo3/ and extract the description via:

    info = IPTCInfo('img.jpg')
    info['caption/abstract']
    

    Which prints:

    b'Gel\xe4ndewagen auf den Salzformationen im Salzsee Ass-Ale in der Danakil-Senke, Danakil-Senke, Hamed Ela, Wollo, \xc4thiopien, Afrika