Building a New Image Format
richardwalshlabs.blogspot.co.uk
richardwalshlabs.blogspot.co.uk
First off, the concept of using the intra-frame compressor of a video format to compress images is unsound. Video compression has constraints that don't apply in still-image compression, and you are dragging that baggage around for no reason. These constraints lead to my other two issues.
One of the biggest problems with JPEG is that block artifacts are often visible even at relatively high quality settings. Post-decoding deblocking algorithms have proven utterly inadequate for fixing this.
One simple and effective leap in mitigating block artifacts is to use larger block sizes. Modern computers are obscenely fast compared to when JPEG was introduced, and we could bump the block size up from 8x8 to 16x16 or even 32x32 without breaking a sweat. This reduces the number of pixels that are at block boundaries, and that means less block artifacts. WebP uses smaller blocks because it's a video format, not an image format.
Another way that you can avoid edge artifacts is to overlap the blocks so that the edge artifacts don't create discontinuities. This is called "time-domain alias cancellation" and it's used in the 1D case by every lossy audio codec you've ever used. It generalizes easily to the 2D case, and it would generalize easily to the 3D case, but for reasons that I don't understand because video compression is not really my field, nobody does video compression by taking the DCT of 3D blocks of video. Instead they use a more ad hoc method of motion compensation, which consists of brute force searching for where blocks in one frame have moved in the next frame. It's not clear how you'd reconcile that with overlapping blocks in the interframe compressor, so VP8 doesn't use overlapping blocks. And by extension, neither does WebM.
Beating JPEG with a new video format is not all that difficult. We have two decades of research between JPEG's introduction and today, and each of us routinely carries hardware in our pocket that would have been considered a major military asset in 1992. It isn't at all surprising that the key frame compressor of a modern video codec would beat JPEG by 25%, but we can do so much better than that. Once we manage to displace JPEG, we're going to be stuck with whatever displaces it for a long time. So we need to make sure we have the best format we can muster before we make that commitment.
(And WebP's real killer feature is lossy-photo + alpha at the same time, that's where there's a real gap in the market at the moment, in between PNG and JPEG.)
Have you seen how people use gif animations?
The only thing I can think of off the top of my head where it's preferable is if you needed to do a video with an alpha channel. But this is more codec related than a problem with the concept itself.
Animated images have several advantages:
-Almost all places that support images support also animated image
-Can be downloaded and reposted (as opposed to canvas)
-No worry about audio, there is no audio
-Seamless looping
-Auto play everywhere
-Variable frame rate
These features could be achieved in a video format, but how would you convince websites that support images to support video with these characteristics?
For example, I would never let people upload autoplaying, looping videos as their avatars or as part of their comment unless I could be 100% sure that there will be no audio. I would have to inspect the video for audio and I would need different handling for images and videos.
Then we don't have to wait for browser makers to implement it in their browsers. You just add a one-line script tag to load webp.js, a script that scans your DOM for img tags with a src that ends with ".webp", and your website has webp support.
If browsers later support webp natively, you can just add a check to webp.js so it turns itself off when a webp-supporting browser is detected.
It's really too bad that Java in the browser never took off; its performance characteristics are far better for writing image decompressors than JS. But JS with a modern HTML5 Canvas running in a modern JS engine on a modern CPU is good enough for the purpose.
Maybe they are waiting for all the promised features to deliver. So far I haven't seen working animations or lossy + alpha in Chrome so they probably aren't ready yet.
The reason given (that I could find, it's a pretty verbose bug entry) is that WEBP doesn't support alpha. Sounds like a pretty weird reason to me, but I'm not a Mozilla developer.
I think the true reason is that evaluating the quality of, and introducing widespread support for, a lossy image format are both really hard problems and Mozilla didn't want to go off half-cocked. Google on the other hand control both ends of the wire and so can see the benefits immediately and as a result are more keen to experiment.
I'm intrigued to see if they do the same with with WebM v2 including VP9 and Opus and just roll it out (in beta even, which makes much more sense for 'disposable' video conferencing use-cases than it does for long-term video storage or Youtube) rather than continue the usual 10-year upgrade treadmill for video codecs.
Higher-bit depths and floating-point components (ala OpenEXR) seem an important feature for any image format that hopes to become a future standard. 8 bits were maybe sufficient in 1990; not so much today. Even microsoft eventually got that clue with JPEG XR...
You only get so many chances to define a new standard, so going with something as lackluster as WebP would seem to be a mistake. JPEG XR, despite its MS origins, seems to be vastly superior. [JPEG XR has licensing issues with the reference implementation (it's from MS after all), but that's not a fatal flaw...]
(Just a guess.)
I'm not sure what your reasoning is there, but it's incorrect. Nearest-neighbor looks really bad even when scaling down to half size.
I disagree.
HTTP supports cache-able compression, and connection re-use. It wouldn't be any slower to download frames as needed (lazy = good)), using the existing transport protocol. All you need is an ASCII/UTF-8 index file for an animation. Getting browsers to support anything new that doesn't come from the W3C and contain the word "semantic" in the spec on the other hand... That's the hard part.
The presentation of the article is atrocious. The font alone renders extremely poorly in Firefox. It is just plain hard to read. Please just use a common font that will render well basically anywhere.
The inline "$3.99 ThanksGiving Offer" ad links peppered throughout the article are distracting, too. They really take focus away from the article itself (unless, of course, that is exactly what they were intended to do).
Then it has one part that goes, "It’s the WebP Image Format (see https://developers.google.com/speed/webp/) as shown here", with an image of the WebP logo that follows. The WebP logo image is a PNG, however! With a lead-in like that, I was sure it was going to be a WebP image demonstrating some of the format's benefits.
The various inline URLs that aren't hyperlinks are very annoying, too. They should obviously have been actual links.
Seeing stuff like "Microsfot" only makes the horrible article look even worse.
While I'm not expecting perfection, nearly everything about this article is sub-par. It's not what I wish to see when I come to HN.
When it comes to information, the Wikipedia article is so much better, yet it's still quite concise, too. For anyone interested, it is at:
> Asking web designers, bloggers, and non-techies to create multiple versions of their images in order to appease every Android, iOS device and desktop browser seems not only like a very non-standards approach, it’s also not a very practical one.
I've never heard of FlashPix, but it seems like just a wrapper around a bunch of variously sized images. The creator still needs to make them and save them or use a program that does it automatically.
And what happens when you request one? You either get them all and download a gigantic file, or the server has to somehow pull out just the part you need.
This problem could be much more easily solved by the extensions to the img tag that allow various src attributes (ignoring the fact that we might not end up with the right one), media queries and using vector formats where possible.
I mean, I am not sure, it will open a can of worms with a lot of problems, but not sure if anyone is trying something in that direction...
A server-side solution where you store the full resolution image only and then use a cache for lower resolution seems much more flexible.