contao / image

Contao Image Library
12 stars 5 forks source link

Add EXIF, IPTC, XMP metadata handling for JPEG, PNG, WEBP, GIF, HEIC, JXL, AVIF #93

Closed ausi closed 1 year ago

ausi commented 2 years ago

I played around a little and parsing metadata works fine (PNG, WEBP and JPEG for now).

But writing metadata will probably be more dificult, as there are no counterparts to iptcparse() and exif_read_data() in PHP. So we will need to write the binary format ourselfs.

So I think to make this possible we need to define a list of fields we want to support (see https://github.com/contao/image/issues/80#issuecomment-862173834 ) because supporting all EXIF, IPTC and XMP tags would be way too much work.

For XMP we could maybe find useful information in the https://github.com/wikimedia/xmp-reader library.

ausi commented 2 years ago

I investigated an Adobe stock image and the following tags seem to be relevant:

IPTC XMP EXIF
Copyright-Hinweis 2#116 dc:rights Copyright (8298)
Ersteller 2#080 dc:creator Artist (013b)
Foto ID 2#115 photoshop:Source
Anbieter 2#110 photoshop:Credit, pur:creditLine

iStock (by Getty Images)

IPTC XMP EXIF
Ersteller 2#080 dc:creator Artist (013b) Copyright (8298)
Foto ID 2#005 dc:title, GettyImagesGIFT:AssetID
Anbieter 2#110 photoshop:Credit
Lizenz-URL plus:Licensor

Fotolia

IPTC XMP EXIF
Foto ID 2#115
Copyright 2#110, 2#116
ausi commented 2 years ago

Reading from PNG, WEBP and JPEG and writing to JPEG already works now 🎉 (Independent of Imagick/GD)

ausi commented 2 years ago

Reading and writing XMP, IPTC-IIM, EXIF from/to JPEG, PNG, WEBP works now 🚀