Closed beschler closed 7 months ago
EXIF metadata support in sharp is provided via libvips+libexif, which only parses EXIF, therefore IPTC and XMP are exposed as binary blobs for parsing with external tools.
You might have some luck with the slightly-misnamed exiftool, which I believe can parse some IPTC and XMP metadata.
That's come up in my searches. I'll look there - thanks for the clarification!
I hope this information helped. Please feel free to re-open with more details if further assistance is required.
Question about an existing feature
The documentation states that the output option
withExifMerge
can be used to retain only the specified EXIF metadata from the input image into the output image. However, how can I also specify other metadata, for example IPTC and XMP tags?(Output option
keepMetadata
indicates that EXIF, ICC, XMP, IPTC metadata can be retained - so this indicates these tags are accessible from withinsharp
.)Additionally, I'm looking to retain the same values for the metadata tags specified, since they currently exist in the input file. (I'm not looking to manually specify override values.)
What are you trying to achieve?
I'm a photographer using Adobe Lightroom Classic and adding copyright information to my photographs. I would like to use
sharp
to optimize my photos for my website, and strip all metadata (e.g. aperture, shutter speed, etc.) from my images except retain metadata that relates to copyright information and original creation date. Specifically, I would like to remove all metadata except retain only the following fields:Artist
Copyright
DateTimeOriginal
OffsetTimeOriginal
Date Created
Time Created
By-line
By-line Title
Credit
Source
Copyright Notice
DateCreated
Source
Credit
AuthorsPosition
creator
rights
UsageTerms
CreatorContactInfo
CreatorCity
CreatorRegion
CreatorWorkEmail
CreatorWorkUrl
WebStatement
When you searched for similar issues, what did you find that might be related?
exifreader
which can read metadata, and has some more flexibility to do things like convert the shutter speed value from a decimal (e.g.0.005
) to a human readable fraction (1/200
), but it cannot write or remove metadata.node-iptc
looks to be able to write metadata, but ultimately I'm not trying to change values (or remove all and add back certain ones - they already exist).sharp
docs mention the ability to do this with EXIF tags, I'm wondering if this can also be done with IPTC and XMP tags as well.sharp
.Please provide a minimal, standalone code sample, without other dependencies, that demonstrates this question
(EXIF tags sourced from EXIF docs.)
Any help is appreciated! Thanks so much!