Live data from Hacker News

WebP - A new image format for the Web (by Google)

developers.google.com

21–30 of 58 posts

Re: WebP - A new image format for the Web (by Google)

#21
So I downloaded libwebp-0.1.3-windows-x86.zip, there is cwebp.exe inside.

I can't figure out how to compress PNGs losslessly into WebP.

These are the options it gives:

    Usage:
     cwebp [-preset ] [options] in_file [-o out_file]

    If input size (-s) for an image is not specified, it is assumed to be a PNG or JPEG file.
    Windows builds can take as input any of the files handled by WIC
    options:
      -h / -help  ............ short help
      -H / -longhelp  ........ long help
      -q  ............. quality factor (0:small..100:big)
      -preset  ....... Preset setting, one of:
                                default, photo, picture,
                                drawing, icon, text
         -preset must come first, as it overwrites other parameters.
      -m  ............... compression method (0=fast, 6=slowest)
      -segments  ........ number of segments to use (1..4)
      -size  ............ Target size (in bytes)
      -psnr  .......... Target PSNR (in dB. typically: 42)

      -s   ......... Input size (width x height) for YUV
      -sns  ............. Spatial Noise Shaping (0:off, 100:max)
      -f  ............... filter strength (0=off..100)
      -sharpness  ....... filter sharpness (0:most .. 7:least sharp)
      -strong ................ use strong filter instead of simple.
      -partition_limit  . limit quality to fit the 512k limit on
                               the first partition (0=no degradation ... 100=full)
      -pass  ............ analysis pass number (1..10)
      -crop     .. crop picture with the given rectangle
      -resize   ........ resize picture (after any cropping)
      -map  ............. print map of extra info.
      -d  .......... dump the compressed output (PGM file).

      -short ................. condense printed message
      -quiet ................. don't print anything.
      -version ............... print version number and exit.
      -noasm ................. disable all assembly optimizations.
      -v ..................... verbose, e.g. print encoding/decoding times

    Experimental Options:
      -af .................... auto-adjust filter strength.
      -pre  ............. pre-processing filter

Re: WebP - A new image format for the Web (by Google)

#22
post #14

We could make the web a lot faster and/or do some really cool stuff if we had a lossy image format with an alpha channel. It'd be nice this got picked up by all browser vendors. Sadly, I fear that they'll be squabbling over it, just like they are with VP8/Ogg/h.264. I really believe that the companies involved in web standards are holding progress back at this point. At the same time, even if they all agreed to put t…

I haven't really tried it yet but I wonder if you might get ugly artifacts if the alpha channel is lossy. Maybe it has to be exact.

In a lossy WebP file with alpha, RGB is lossy but the alpha channel itself is lossless.

Re: WebP - A new image format for the Web (by Google)

#23
post #21

So I downloaded libwebp-0.1.3-windows-x86.zip, there is cwebp.exe inside. I can't figure out how to compress PNGs losslessly into WebP. These are the options it gives: Usage: cwebp [-preset ] [options] in_file [-o out_file] If input size (-s) for an image is not specified, it is assumed to be a PNG or JPEG file. Windows builds can take as input any of the files handled by WIC options: -h / -help ............ short he…

Did you try -q 100? That might be an idiom for lossless.

Re: WebP - A new image format for the Web (by Google)

#24
post #14

We could make the web a lot faster and/or do some really cool stuff if we had a lossy image format with an alpha channel. It'd be nice this got picked up by all browser vendors. Sadly, I fear that they'll be squabbling over it, just like they are with VP8/Ogg/h.264. I really believe that the companies involved in web standards are holding progress back at this point. At the same time, even if they all agreed to put t…

…if we had a lossy image format with an alpha channel…

Just what I thought last time this came up. Built it. No one came.

http://jim.studt.net/jpeg-alpha/

(I haven't looked at that code in 18 months, but it explores some options and lets you have JPEG images with alpha channels in your browser.)

Re: WebP - A new image format for the Web (by Google)

#25
post #14

We could make the web a lot faster and/or do some really cool stuff if we had a lossy image format with an alpha channel. It'd be nice this got picked up by all browser vendors. Sadly, I fear that they'll be squabbling over it, just like they are with VP8/Ogg/h.264. I really believe that the companies involved in web standards are holding progress back at this point. At the same time, even if they all agreed to put t…

I haven't really tried it yet but I wonder if you might get ugly artifacts if the alpha channel is lossy. Maybe it has to be exact.

You'd probably be OK as long as the alpha extremes (0 and 255) were lossless; everything in between could probably cope with being slightly off, especially if you could control the quality of alpha and YUV separately, and the YUV quality was (somewhat) weighted by alpha, with a 1 pixel "border" into transparent areas to support interpolation when scaling. Lossless alpha and lossy YUV is already a major improvement over the status quo, however.

Re: WebP - A new image format for the Web (by Google)

#27
post #23
post #21

So I downloaded libwebp-0.1.3-windows-x86.zip, there is cwebp.exe inside. I can't figure out how to compress PNGs losslessly into WebP. These are the options it gives: Usage: cwebp [-preset ] [options] in_file [-o out_file] If input size (-s) for an image is not specified, it is assumed to be a PNG or JPEG file. Windows builds can take as input any of the files handled by WIC options: -h / -help ............ short he…

Did you try -q 100? That might be an idiom for lossless.

I did, and it produced a huge .webp file, 6.7 times larger than the original PNG.

Re: WebP - A new image format for the Web (by Google)

#28
post #14

We could make the web a lot faster and/or do some really cool stuff if we had a lossy image format with an alpha channel. It'd be nice this got picked up by all browser vendors. Sadly, I fear that they'll be squabbling over it, just like they are with VP8/Ogg/h.264. I really believe that the companies involved in web standards are holding progress back at this point. At the same time, even if they all agreed to put t…

I, too, would like to see other browser vendors follow and I don't see the same obstacles as with video codecs so there's hope yet. Microsoft's plans for IE auto-updating should also help (if they decide to support WebP) but admittedly it'd still be a long wait for web developers.

We (Opera) started supporting WebP not long after its release and it's proved to be an effective improvement on JPEG. IIRC, there's a roughly 30%-40% reduction in image filesizes when used as part of our server-side compression feature (Turbo) which converts all JPEGs into WebP (among other stuff).

Of course, support in all modern browsers and being able to use WebP exclusively in public sites are not closely connected, unfortunately, but for sites with high image usage, detection for support and server-side image replacement could be worthwhile.

Re: WebP - A new image format for the Web (by Google)

#29
post #8
post #6

Earlier quoted context omitted.

Exactly, is and will stay irrelevant for web developers until it gets adopted by more browsers. Google displays PNG still today on Google.com for Chrome users.

Yeah, I feel the slight advantages it brings to the table are easily overwhelmed by the fact that I have to carry two sets of images, and use browser detection to switch between them. Even if Firefox and IE picked it up, their older versions are still not going to support the format. This makes it not very useful for at least 4-5 years.

You can also use a service like http://torbit.com to create copies of all your images and serve up the right version to each browser that visits.

Re: WebP - A new image format for the Web (by Google)

#30
post #24
post #14

We could make the web a lot faster and/or do some really cool stuff if we had a lossy image format with an alpha channel. It'd be nice this got picked up by all browser vendors. Sadly, I fear that they'll be squabbling over it, just like they are with VP8/Ogg/h.264. I really believe that the companies involved in web standards are holding progress back at this point. At the same time, even if they all agreed to put t…

…if we had a lossy image format with an alpha channel… Just what I thought last time this came up. Built it. No one came. http://jim.studt.net/jpeg-alpha/ (I haven't looked at that code in 18 months, but it explores some options and lets you have JPEG images with alpha channels in your browser.)

I've actually used this technique before. You can also use an SVG clip path to do something similar in Firefox. When I used this technique I shipped the mask as a separate file as I wasn't familiar enough with the file format to realize I could attach it. The 63KB limit when attaching the mask to the image might be too close.

If you make an app that can take a PNG and convert it to JPEG with alpha channel can you let me know? I would be VERY interested in this.

Post reply on HN