15

I want to replace my .png and .jpg files in android project with .webp to reduce the app size.

I am verifying these 3 cases for jpg to webp conversion(for both .png and .jpg) :

  1. Lossy with 80% quality
  2. Lossy with 100% quality
  3. Lossless

for Case 1, size was reduced by ~30% as expected

But for cases 1 and 2, size was increased significantly(170KB of .jpg to 470KB of .webp) instead of decreasing.

Command used :

cwebp -q 100 input.jpg -o output.webp

This is working fine with .png images for all three cases where sizes are reduced when converted to .webp format.

But the same is not working with the .jpg image ? Does size reduction depend on .jpg image ? Is size guaranteed to reduce when converted from .jpg/.png to .webp ? Why did the size increase ?

Version of libwebp : libwebp-0.4.3 OS - Windows 64-bit

4

2 回答 2

4

您面临的问题是,对于 JPEG,您可以操纵大量变量来获得不同的压缩。这就是您从有损压缩中获得的好处。无损压缩往往很少(如果有的话)。在无损压缩中,权衡是时间与压缩。有损是质量与压缩。

您正在通过第二个有损压缩过程运行有损压缩图像并获得相当不可预测的结果。

真正的比较是获取您的 PNG 图像并使用 webp 和 JPEG 使用各种设置对其进行压缩,以查看与压缩相比您获得的质量。

于 2015-06-04T19:27:54.123 回答
1

包括对随 WebP 格式一起提供的 Google 文档的参考,其中介绍了在转换为 WebP 格式时文件大小可能会增加。

是的,通常在从有损格式转换为 WebP 无损格式时,反之亦然。这主要是由于色彩空间差异(YUV420 与 ARGB)以及它们之间的转换。

https://developers.google.com/speed/webp/faq#can_a_webp_image_grow_larger_than_its_source_image

于 2020-11-03T05:14:33.987 回答