weserv / images

Source code of wsrv.nl (formerly images.weserv.nl), to be used on your own server(s).
https://wsrv.nl/
BSD 3-Clause "New" or "Revised" License
1.84k stars 187 forks source link

GIF to WebP causes increased file size #328

Closed Sir-Will closed 1 year ago

Sir-Will commented 2 years ago

When using the image server to convert a GIF to WebP, I have noticed that the WebP file is larger than the original GIF.

What causes the increased file size? Shouldn't it be smaller?

Example: https://images.weserv.nl/?url=https://i.ibb.co/ch2v7wk/1b9770514b2c82f47bf60baf1bc007c6.gif&n=-1&output=webp https://i.ibb.co/ch2v7wk/1b9770514b2c82f47bf60baf1bc007c6.gif

kleisauke commented 2 years ago

WebP images can be optimized by setting the quality (&q=) parameter. For example, adding &q=60 to the first URL will make the WebP image smaller than the GIF image in size. By default a quality of 80 is used, which usually produces excellent results.

Perhaps the provided GIF image was optimized with something like Gifsicle?

kleisauke commented 1 year ago

I hope this information helped. Please feel free to re-open if questions remain.

Sir-Will commented 1 year ago

I ended up converting them to mp4, as I wasn't able to get the gif smaller than a mp4.