Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 46 commits into from
Feb 17, 2023

Conversation

ausi
Copy link
Member

@ausi ausi commented Nov 17, 2022

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 #80 (comment) ) 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
Copy link
Member Author

ausi commented Nov 17, 2022

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
Copy link
Member Author

ausi commented Nov 19, 2022

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

@ausi
Copy link
Member Author

ausi commented Dec 2, 2022

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

@ausi ausi changed the title EXIF, IPTC, XMP metadata proof of concept EXIF, IPTC, XMP metadata for JPEG, PNG, WEBP, GIF, HEIC, JXL, AVIF Jan 28, 2023
@ausi ausi marked this pull request as ready for review January 29, 2023 21:23
@ausi ausi requested review from leofeyer and m-vo January 29, 2023 21:24
src/Metadata/MetadataParser.php Outdated Show resolved Hide resolved
src/Metadata/MetadataParser.php Outdated Show resolved Hide resolved
Copy link
Member

@m-vo m-vo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks very nice and very powerful! ❤️
Nitpicks in the comments but the general concept is 👍

@ausi ausi requested a review from m-vo February 16, 2023 21:39
@ausi ausi changed the title EXIF, IPTC, XMP metadata for JPEG, PNG, WEBP, GIF, HEIC, JXL, AVIF Add EXIF, IPTC, XMP metadata handling for JPEG, PNG, WEBP, GIF, HEIC, JXL, AVIF Feb 17, 2023
@ausi ausi merged commit 98ce109 into contao:1.x Feb 17, 2023
@ausi ausi mentioned this pull request May 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants