sharp
sharp copied to clipboard
Can withMetadata be used to modify JPEG exif info without re-encoding image data (lossless)?
Can withMetadata be used to modify JPEG exif info without re-encoding/altering image data (lossless)?
What are you trying to achieve?
The ability to add/modify exif information to a JPEG image without any other type of image data modification (completely lossless), such as what can be accomplished with exiftool
When you searched for similar issues, what did you find that might be related?
Apologies if I missed anything, but my search didn't come across anything specifically referencing whether sharp's method of modifying exif data can be completely lossless if no other image operation is occurring. The withMetaData
example in the documentation is ideally how I would like to be able to add metadata to an existing JPEG image, but I don't see a way in either the documentation or my testing to add metadata without re-encoding the image data as well. If the JPEG quality option is omitted the quality level appears similar, but a diff of the image data reveals it is a re-encode. If I set the quality option to 100 the image is more than double the size and (obviously) was also re-encoded.
Is it possible in sharp to add metadata and keep all the image data unchanged? Is it even possible in the underlying libvips?
No, sorry, if you only want to modify EXIF metadata (and not pixel data) then you'll probably want a different tool.
Cross-discussion at https://github.com/libvips/libvips/discussions/2980 so closing this.
Perhaps try https://github.com/photostructure/exiftool-vendored.js
@lovell Thanks for that suggestion! I had somehow not found that particular project yet.