-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
The getexif() method of PIL.Image could use some enhancements, which most likely require an API bump. I'm just listing some ideas/shortcomings of the current implementation here, which I would love to see addressed (and could possibly contribute to, if the changes are agreed upon).
- The return type of
getexif()isExif. But without further processing, it's really only IFD0. However, already returning an IFD makes theget_ifd()method look out of place. Therefore, I recommend to implement theExifclass as a dict linking to all extracted IFDs. - Either providing specialized methods for common IFDs (e.g.
Exif.get_ifd0()) or named constants for common IFDs (e.g.Exif.get_ifd(ExifTags.IFD.IFD0)) would improve the usage of the API a lot. (Added IFD enum to ExifTags #6748) - Implement tag names for missing IFDs (especially IFD1 and Interop) (Added Interop to ExifTags #6724)
- Some tags are purely technical and should never be edited by hand (the IFD offsets come to mind here). It would be nice to have a flag not to return them to the user. (Added Exif hide_offsets() #6762)
- Some integer tag values encode a human readable description, for example Flash and LightSource. It would be great to provide named constants for those as well as methods to return the description as a string. (Added LightSource tag values to ExifTags #6749 for LightSource)
I can't say anything about the feasability regarding licencing, but maybe the tag names could be scraped from the Exiftool website (the quasi reference implementation of the Exif format): https://exiftool.org/TagNames/EXIF.html
There are already other python libraries for Exif handling, but they all suffer from fragmentation. As the Pillow library already does the heavy lifting of extracting the IFDs anyway, I think providing a convenient and nearly complete view of the data can be a significant improvement to the project.