Reputation: 2458
I have an image upload function on my application that is using firebase as a backend. I've enabled the Resize Images extension, but the quality was too low on jpeg and webp files. In order to counteract this I added some Sharp Output Options as follows:
{"jpeg": {"quality": 100}, "webp": {"quality": 100, "lossless": true}}
There's no real information out there about what the potential values are for these fields.
You can see their suggested formatting for the Sharp Output Options here:
That's all the info I can find.
However, the image quality did not change after this config. Both before and after setting this configuration the image sizes were identical.
How can I properly set this configuration and increase the quality of the compressed images?
Upvotes: 2
Views: 1019
Reputation: 2458
My solution was to increase the pixel size of the images. Instead of targeting 400x400, I chose 800x800. The file size was slightly larger, but only about an extra 7kb for an image that was originally 1.3mb. After firebase's compression, my 800x800 image was around 22kb, but with much better resolution than the 15kb 400x400 image I was trying at first.
Upvotes: 2
Reputation: 11
I have the same problem.
When I tried to convert .jpg to .jpeg and set the option to {"quality": 5}, a clear deterioration was confirmed.
And the following three had the same degree of deterioration.
It seems that sharp in the extension has already been resized for minimal degradation.
Looking at the source file, sharp's outputOptions were only applied during the conversion.
I thought the cause was elsewhere and decided to finish my investigation into this extension.
However, I'm worried about rotate, which seems to be meaningless ...
Sharp https://sharp.pixelplumbing.com/api-output#jpeg
Upvotes: 0