Imager-Craft
Imager-Craft copied to clipboard
Strip META but Preserve ICC Color Profiles
Is there any way Imager could be configured to strip the meta data but only keep the ICC Color Profiles? I believe this would still result in slightly smaller sizes, one of the benefits of removing the META data, but still ensuring the image is correct.
I have a series of black and white images that are getting darkened when I set 'removeMetadata' => true, but setting it to false is adding a good 30KB to the larger images.
Here are some comparisons.
Original Image
'removeMetadata' => false
313KB
1164 × 1601px
Colour space: Grey
Colour Profile: Generic Gray Gamma 2.2 Profile
'removeMetadata' => true
289KB
1164 × 1601px
Colour space: Grey
I am not entirely sure where the Colour space: grey is getting set? is this something Imager/iMagick is doing?
This should really be the default option for all these image optimisiation things - stripping ICC profiles is not a lossless operation (especially in a world no colour managed web browsers as we now live in).
@terryupton You can generally solve this at your end for now by using your own option string for the optimisations e.g. jpegoptim
use something like:
'optionString' => '--strip-com --strip-exif --strip-iptc --all-progressive',
I'll put this on my todo-list for the next version of Imager I'm working on, and see what I can come up with. At the moment I'm using the built-in strip
method in Imagine, which doesn't allow for any fine-grained removal - it's all or nothing - so I'll have to roll my own functionality then.
@terryupton Just to be clear, you're only transforming the image using width/height and similar, or are you also doing effects: { grayscale: true }
on them?
@bossanova808 That's a nice hack. :)
@aelvan no effects just size transforms. Interestingly is does add _greyscale- to the end of the transformed filename, so it seems like something else might be occurring behind the scenes or as a bug?
(I am using effects....can't deal with transforms without some image sharpening happening!)