2

When I see a JPG file, I know for sure this file is lossy. When I see a PNG file, I know for sure it is lossless.

But WebP is a different thing, it supports both lossless and lossy "modes", so how I can detect whether a downloaded .webp file is lossy or lossless?

6
  • 2
    I thought this might be easy to answer by examining the file header in an image. Turns out it's not so easy since WebP images can contain not only lossless or lossy images, but also a mixture of both. Maybe this question would be better suited to Computer Graphics Stack Exchange or perhaps Stack Overflow, as it seems to be quite technical, rather than just a graphic design question.
    – Billy Kerr
    May 12 at 9:00
  • A mixture of both? So in simple words there could be a webp image with two apples, one apple is lossless and another one is lossy, and so after you save this image 10 million times, the first apple will have a poor quality, but another apple will be perfect?
    – john c. j.
    May 12 at 9:13
  • I'm not really sure of all the pros and cons of the format, sorry. But yeah I see it frequently referred to as a container format - which means one file can contain different kinds of images with different encoding.
    – Billy Kerr
    May 12 at 9:51
  • I'm genuinely curious - if you're downloading an image from a page on the web, why does it matter?
    – JeffK
    May 12 at 14:17
  • You do not actually know if a png is lossless. It might have been lossily crunched before save for better compressibility. So basically you only know a format that is always lossy like jpeg is lossy. Every format touted as lossless can be both lossy and lossless.
    – joojaa
    May 12 at 14:21

1 Answer 1

2

You can use the command webpinfo from google's libwebp package.

Example of a lossy webp:

webpinfo yellow_rose_lossy.webp | grep Format

Output:

Format: Lossy (1)

Example of a lossless webp:

webpinfo yellow_rose_lossless.webp | grep Format

Output:

  Format: Lossless (2)

You can download the example files from this page

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.