When I convert many little icons for example. They all vary a little bit in width/height. Then I just want to convert them and not having to stick around with width and height for example.
But internally the function can just get the width and height and keep it the same if I do not specify anything.
In cwebp there is a separate argument that is called “lossless” as q100
is not lossless. But I can see the q0
as a good alternative here.
Also the controll over the filesize in some cases can be important instead of quality.
On some onlineconverters you are able to specify a %
or a direct target filesize
which are optional to the quality settings. Like:
{{ $imgWebp = $img.Convert "webp q100" }}
{{ $imgWebp = $img.Convert "webp 30%" }}
{{ $imgWebp = $img.Convert "webp 70kb" }}
Then should all be valide.
q100 aims to produce the highest quality (non lossless)
30% aims to produce a picture with about 30% of its original filesize
70kb aims to produce a image with about 70kb size
Also a setting should be there to prevent the creation of the conversion if the new file is bigger then the original one. This mostly happens at lossless settings. If converted size is bigger then original size then you dont need the conversion, but you rather would be better if you stick with the original PNG/JPEG.