Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Image size is increased when converted from jpg to webp with quality value 100

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

like image 464
userv Avatar asked Jun 04 '15 10:06

userv


People also ask

Does WebP reduce image size?

Using WebP, webmasters and web developers can create smaller, richer images that make the web faster. WebP lossless images are 26% smaller in size compared to PNGs. WebP lossy images are 25-34% smaller than comparable JPEG images at equivalent SSIM quality index.

Is WebP bigger than JPEG?

Google's research shows it has managed to successfully compress images into significantly smaller file sizes. The company reports that WebP boasts the benefit of being 26% smaller than PNG files and 23–24% smaller than equivalent JPG files. A WebP image size can be up to 16383 × 16383 pixels.

Are WebP files smaller than JPEG?

The WebP compression algorithm was created, according to Google, as an alternative for both PNG and JPEG files. Generally, the resulting WebP image is on average 26% smaller than the original PNG, and 25-34% smaller than the original JPEG.

How do I resize an image for WebP?

❓ How can I resize a WEBP image? First, you need to add a WEBP image file: drag & drop your WEBP image file or click inside the white area to choose a file. Then adjust resize settings, and click the "Resize" button. After the process completes, you can download your result file.


1 Answers

The problem you face is that with JPEG there is are large number of variables you can manipulate to get different compression. That is the benefit you get from lossy compression. Lossless compression tends to have few (if any options). In lossless compression, the tradeoff is time vs. compression. In lossy it is quality vs. compression.

You are running a lossy compressed image through a second lossy compression process and getting rather unpredictable results.

The real comparison would be to take your PNG images and compress them using webp and JPEG using various settings to see what quality you get compared to the compression.

like image 118
user3344003 Avatar answered Sep 20 '22 08:09

user3344003