Save-webP-as-extension
Save-webP-as-extension copied to clipboard
[Question] Why is there a signicant file size difference between your conversion method and letting FFmpeg do it?
Example image (21.6KB).
When saving the .webp
image with your extension as .jpg
(100%), the the file size will be 194.1KB (Linux, ext4).
When converting using FFmpeg the the file size will be 62.8KB.
Is that because Firefox uses the canvas?
Linux FFmpeg command to save in best quality:
for i in *.webp; do ffmpeg -i "${i}" -qmin 1 -q:v 1 -bsf:v mjpeg2jpeg "${i%.webp}.jpg"; done
Interesting. Do PNG images come out the same size?
What this add-on does is create a canvas, draw the target image onto the canvas, extract a blob from the canvas, then download the blob in your selected format. You can see this on lines 192-217:
https://github.com/jscher2000/Save-webP-as-extension/blob/master/fmtbtns.js#L192
So somewhere in that process, there is a difference from ffmpeg, but I couldn't tell you where or what it is. Even if I could, since I'm just using the built-in facilities Firefox provides, I don't have any control over its compression algorithm.
Do PNG images come out the same size?
With the extension: 285.6KB
With FFmpeg: 276KB
(FFmpeg command: for i in *.webp; do ffmpeg -i "${i}" "${i%.webp}.png"; done
)
So less difference here.
I don see a noticeable difference in quality, when looking at the jpg's at 500% enlarged:
Firefox processed:
FFmpeg processed:
Image info. Firefox processed:
FFmpeg processed:
So, there is a difference in print size and resolution (this is not the case with the png's) Note, that I'm not an expert in this field. 😀️