sharp icon indicating copy to clipboard operation
sharp copied to clipboard

Enhancement: add/update XMP and IPTC metadata

Open woss opened this issue 1 year ago • 3 comments

Question about an existing feature

I saw that there are a lot of functions that help with changing metadata, I've also checked the tests but what I am interested is in https://github.dev/lovell/sharp/blob/eab7dc1b4942038fd824747c10b4b9eda60ca72e/src/metadata.cc#L119 and https://github.dev/lovell/sharp/blob/eab7dc1b4942038fd824747c10b4b9eda60ca72e/src/metadata.cc#L111

For example, I need to write the xmp:plus:DataMining tag as well as other IPTC tags like the WebstatementURL. How do I write these tags? Which IFD do they belong to?

I also checked the libvips docs and found that this https://www.libvips.org/API/current/libvips-header.html#vips-image-set is used to write the data based on these parts https://www.libvips.org/API/current/libvips-header.html#VIPS_META_XMP_NAME.

Currently, I use the Exiftool to write and share to process, which is quite slow for many images.

XMP:PLUS tags as described here https://exiftool.org/TagNames/PLUS.html#XMP

I would really like to understand how this can be done in sharp directly.

Thank you for the time reading and hopefully answering.

woss avatar Jul 01 '24 14:07 woss

This is a future possible enhancement, which was previously hinted at in https://github.com/lovell/sharp/issues/650#issuecomment-813371338

lovell avatar Jul 01 '24 17:07 lovell

oh, right, i remember reading this at some point. thanks for the answer

woss avatar Jul 01 '24 19:07 woss

hey, I've create a PR to enable setting the XMP data as a buffer. This enables copying XMP data from an image to another one. Feel free to share feedback on the PR: https://github.com/lovell/sharp/pull/4416

tpatel avatar Jun 16 '25 22:06 tpatel