Hi
I have jpeg image which I want to optimise to quality 80. The original image is 246KB and can be seen below

I used sharp to reduce quality to 80 and output format as jpeg (.quality(80).jpeg()). The image I get is a rather washed out one. The size is 87.7KB.

I used mozjpeg CLI for the same (./cjpeg -quality 80 >
I used vips CLI (vips copy
I want to know, if there is a specific setting/command that is "reducing" the colors in the image and can it be avoided in sharp. I understand that the compression ratios of mozjpeg and vips vary. Thus, there is a slight color change from the original image, and the output image file sizes vary for the two CLIs. What is it that is additionally used in sharp to get a file size that is lower than that obtained using command line vips.
Hello, are you able to share the original JPEG image? (Everything here is a PNG image, likely due to Github mangling.)
Can you check on the link here
https://drive.google.com/drive/u/0/folders/0BznBgV252hG1d0l0WnVUdzVtcUU
Also, I noticed, and I might be wrong in this observation, that the color difference is more pronounced when the images are opened in the browser (and even in the images I attached in the previous pos) versus viewing the same images in some other application on my system (like viewer on Mac or Sketch)
Your images have about 15 - 20kb of metadata attached to them. If I run vipsheader -a I see:
$ vipsheader -a original.jpg
...
jpeg-thumbnail-data: VIPS_TYPE_BLOB, data = 0xe94bb0, length = 2370
exif-data: VIPS_TYPE_BLOB, data = 0xe92aa0, length = 2682
ipct-data: VIPS_TYPE_BLOB, data = 0xe95570, length = 4728
xmp-data: VIPS_TYPE_BLOB, data = 0xe967f0, length = 3718
icc-profile-data: VIPS_TYPE_BLOB, data = 0xe97680, length = 3144
sharp is stripping all this off in order to make the thumbnail smaller. Something is different (perhaps rendering intent?) between sharp's treatment of the ICC profile and the way your viewer is handling it, making the colour looks a little different.
Here's the "most correct" version of your image. I imported original.jpeg to CIELAB with perceptual intent using the embedded profile, then exported to 8-bit sRGB PNG with no profile. It should look the same in all viewers.

Put the samples into separate tabs in your web browser, then try flipping between them. The closest is the winner.
The original JPEG image is in a device-dependent RGB colourspace.
sharp converts to the device-independent sRGB using the embedded RGB profile with a perceptual intent, then removes the original profile as it is no longer relevant.
The reason for always using sRGB output is that web browsers have generally been pretty bad at device-dependent colour rendering, although the situation is improving. There's a great test page at https://kornel.ski/en/color
The gamut of sRGB is usually narrower than RGB, especially with green and blue hues.
There's some discussion at #218 about exposing the ability to provide custom profiles.
Thanks for clarifying :)
Most helpful comment
Here's the "most correct" version of your image. I imported
original.jpegto CIELAB with perceptual intent using the embedded profile, then exported to 8-bit sRGB PNG with no profile. It should look the same in all viewers.Put the samples into separate tabs in your web browser, then try flipping between them. The closest is the winner.