-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Take advantage of libvips new "keep" feature to increase control over output metadata #3856
Conversation
I'm thrilled to see the progress on this! After reviewing it, I wanted to share some thoughts. Using Here's where I see a potential enhancement. With vips icc_transform input_cmyk_fogra39_with_icc.jpg "output_cmyk_swop_stripped.jpg[keep=none]" "U.S. Web Coated (SWOP) v2.icc" In the current implementation of this PR, achieving this seems not possible because using any of the new functions inadvertently adds an ICC profile to the output file, so its behaviour does not entirely match what Recognizing that the current approach might be tailored to more common use cases, I wonder if it's possible to introduce an optional boolean flag to Alternatively, integrating the same metadata flags as in
Would love to hear your thoughts on this. |
@adriaanmeuris I'd like to avoid an API that allows people to create invalid or incorrectly-rendered images. An image that uses a profile should attach that profile (the exception perhaps being device independent profiles such as sRGB). I'm aware your use case is for PDFs, but sharp isn't really designed for PDF manipulation. |
@lovell I completely share your concern about preventing the creation of incorrectly rendered images with sharp, and it's not my intention to compromise this aspect of the library. I do want to point out that my use of sharp is not for PDF manipulation, but rather for preprocessing images for a target that is not a browser. Unlike browsers, where stripping out the sRGB profile by default is standard due to browsers assuming untagged images are in sRGB, other targets can offer more precise control over color consistency. For ICC-based images in PDFs, the format refers to a separate ICC buffer (the one available in sharp's Considering this, would you be open to a separate function such as I'd certainly be open to creating a PR to make this possible. |
243e2ca
to
1ec4ad6
Compare
@adriaanmeuris The new .withIccProfile('profile.icc', { attach: false }) |
Add new withX and keepX functions that take advantage of libvips 8.15.0 new 'keep' metadata feature.
1ec4ad6
to
334efe5
Compare
Thanks, @lovell! I've tested the new |
libvips v8.15.0 deprecated the "strip" option for removing all metadata, instead replacing it with a set of more fine-grained "keep" flags.
This PR adds new functions to take advantage of this:
EXIF can now be either replaced or merged, plus there are new TypeScript definitions for EXIF metadata structure.
The input ICC profile can now be attached to the output image.
The
exif
andicc
properties ofwithMetadata
are now deprecated. The ability to provide a boolean towithMetadata
has been removed.Relates to #3824 and #2910