'Picture quality still reducing too much even after configuring resize images extension on firebase
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?
Solution 1:[1]
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.
- No options
- {"Quality": 100}
- No conversion
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 ...
Solution 2:[2]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | sajico |
Solution 2 | crevulus |