News for hackers. Stuff that matters.
Re:WebP – A new image format for the Web by workhere-io on Sunday March 23, 2014 @03:28AM (#7452483)
Things to consider: WebP browser support is currently terrible (http://caniuse.com/webp), and it seems the solution to make WebP images display in non-supported browsers is through the help of a rather large JS file (http://webpjs.appspot.com/).
Re:WebP – A new image format for the Web by Theodores on Sunday March 23, 2014 @04:20AM (#7452569)
Actually it is Google Pagespeed where the magic happens. You serve jpg, gif, png, pcx^H^H^H and then your nginx/Apache converts them to webp for you, on the fly, cached. If the person requesting your page runs chrome they get webp.

So that means everyone else gets a slow image format? Yes, but you have saved bandwidth and your pages have loaded quickly for ~50% of your users.

I don't think webp is really a source image format, more something that is browser and Pagespeed specific. Try it, you will be impressed.

Re:WebP – A new image format for the Web by billyhoffman on Sunday March 23, 2014 @06:39AM (#7452834)
There is a big problem with auto-converting images, and its with HTTP caching.

Consider this: I have page.html, with an <img src=logo.jpg> tag. If I'm using Chrome and I request logo.jpg PageSpeed/the web server detects that I support WebP via the Accept header. It sends WebP image for the URL logo.jpg.

And that's a problem. Because the content for logo.jpg is no longer dependent entirely on the URL. It the URL, and the values of the User-Agent or the Accept headers, which determine the response.

This is called content negotiation and it utterly nullifies shared HTTP caching. This is bad because shared HTTP caching can be a huge performance win.

The right way to serve WebP images is to change the URL. The application logic that generates the HTML should detect that browser support webp and rewrite the image tag accordingly. In other words, page.html should include a <IMG src=logo.webp> tag.

This means that browsers that support webp get it, browsers that only support JPEG get it, and shared HTTP caches can be used without polluting the cache.

Sadly, PageSpeed and other technologies like it aren't currently smart enough to re-write the URL in the base HTML page. As always, technology that "automatically fixes problem X" rarely is the best solution.

Re:WebP – A new image format for the Web by drdaeman on Sunday March 23, 2014 @07:35AM (#7452969)
Isn't the caching issue trivially fixable with "Vary: Accept" header? (No idea whenever PageSpeed adds that or not.) Content negotiation shouldn't interfere with caching, if both are done properly.

Also, if you respond with different HTML, you still get the caching issue, because you may mistakenly serve cached HTML linking to WebP images to non-capable client. So the cache should still consider Vary and Pragma headers (or it's broken).

The only thing I don't really fancy about "/cute/kitten.jpg" serving a WebP image is ".jpg" part. If content-type may vary, the "extension" part of the "filename" should be generic ("/cute/kitten.image") or missing ("/cute/kitten"). That's for saving pics, when URLs transform into filenames.

Re:WebP – A new image format for the Web by billyhoffman on Sunday March 23, 2014 @08:13AM (#7453045)
2 things:

First, "Vary:Accept" and Vary:User-Agent effectively nullifies shared caches. Because instead of saving 1 copy of a response for a URL, and serving it to all requests, a shared cache has to save 1 copy per unique combination of URL and the Accept request header and/or the User-Agent header sent by the browser.

Browsers send wildly different Accept header values, not only across browser vendors but across versions as well. And the User-Agent string has insane variation since OS, CPU, language, and more can be included.

The net result is that all these unique request header values fragment the shared cache so much that you don't get any cache hits. The shared cache has been nullified.

Second, if the HTML is a static file, yes you have the same problem. However, in the modern age of web publishing, the HTML is almost always being dynamically generated by some application logic/CMS/something. This means that it is rarely is ever cached or marked as cachable to shared caches.

More about Vary and shared caching: http://zoompf.com/blog/2010/03/the-big-performance-improveme...

http://blogs.msdn.com/b/ieinternals/archive/2009/06/17/vary-...

Re:WebP – A new image format for the Web by acdha on Sunday March 23, 2014 @09:35AM (#7453246)
> Content negotiation shouldn't interfere with caching, if both are done properly.

Unfortunately, “done properly” excludes things like nginx's cache module, a number of CDNs, and even certain browser caches. Some of the bugs are obvious – e.g. returning gzipped data to a client which didn't request it – but others will simply require monitoring to realize that your cache isn't caching anything or has a dismal cache hit rate because every permutation of request headers and the values referenced in Vary are being treated independently. Worse, all of these can change unexpectedly due to updates in “stable” software so you need deep monitoring checks to ensure that everything is still working the way it was when you set it up.

The more I've used content negotiation, the less I'm convinced that it's a desirable feature. Unless you tightly control the client, server and all intermediaries you'll spend a ton of time on operational overhead and the alternative is that you simply use unique URLs which will always work correctly after the initial implementation, which is also easier.

Re:WebP – A new image format for the Web by scaz on Sunday March 23, 2014 @07:44AM (#7452987)
You cache negotiated responses[1] using the Vary header[2]. PageSpeed does rewrite URLs in the HTML, it just isn't needed in this case.

[1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13...

[2] http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14...

Re:WebP – A new image format for the Web by justincormack on Sunday March 23, 2014 @09:11AM (#7453186)
That does not solve the problem either, than you cannot cache the served page, as it will either have logo.webp or logo.jpg in it (well if it is dynamically generated per user this might not be an issue).

The correct answer is something like the video tag, with a choice, polyfills, or headers that are useful enough to do a small scale Vary on. None of which are very good solutions.

Re:WebP – A new image format for the Web by yaix on Sunday March 23, 2014 @07:35AM (#7452968)
Very true.
Re:WebP – A new image format for the Web by threeseed on Sunday March 23, 2014 @05:01AM (#7452651)
I'm confused what you are doing. You are taking an existing lossy format e.g. JPG and then recoding it in another lossy format. So yes you may save an insignificant amount of bandwidth but at the expense of introducing potentially significant artefacts in your images. What serious web developer is going to want to do this ?
[deleted]
Re:WebP – A new image format for the Web by threeseed on Sunday March 23, 2014 @05:17AM (#7452675)
WebP IS lossy: http://en.wikipedia.org/wiki/WebP

And as you can see from the page there are artefacts that humans can perceive.

Re:WebP – A new image format for the Web by jkn on Sunday March 23, 2014 @05:53AM (#7452744)
Both the original article and the Wikipedia page state that WebP support lossy and lossless compression. I guess using lossless WebP would not make sense for JPEG files as the result would probably be bigger than the original JPEG, but it might work well with PNG.
Re:WebP – A new image format for the Web by evilduck on Sunday March 23, 2014 @11:23AM (#7453648)
Re:WebP – A new image format for the Web by ntakasaki on Sunday March 23, 2014 @07:35AM (#7452967)
>Yes, but you have saved bandwidth and your pages have loaded quickly for ~50% of your users.

I don't think ~50% of users are running Chrome. Where are you getting your numbers from?

Re:WebP – A new image format for the Web by jessaustin on Sunday March 23, 2014 @09:10AM (#7453183)
Perhaps 50% of your users aren't, but services exist for which that is the case. It doesn't really change the point being made however: would you really have preferred the statement "...your pages have loaded quickly for 38.271% of your users"? That's why the "~" was included to indicate approximation.
Re:WebP – A new image format for the Web by xpose2000 on Sunday March 23, 2014 @10:47AM (#7453518)
Just to follow up on your comment. For those less willing to use the apache module, there is always the pagespeed web service where you can change DNS to get this accomplished. (And utilize Google's CDN as well).

https://developers.google.com/speed/pagespeed/service

Re:WebP – A new image format for the Web by jlouis on Sunday March 23, 2014 @11:10AM (#7453605)
Google thought of this. Their Chrome browser probes for WebP server-side support through content negotiation. So you can still serve JPEGs to browsers, but those which are modern can get WebP images.
Re:WebP – A new image format for the Web by skbohra123 on Sunday March 23, 2014 @03:46AM (#7452515)
This will improve with time, every new technology starts like this and if it's better than the current technology, it sticks.
Re:WebP – A new image format for the Web by threeseed on Sunday March 23, 2014 @05:03AM (#7452654)
WebP was released 3 years ago hence your entire premise is faulty.

The real truth is that being the best technically rarely guarantees success in the market.

Re:WebP – A new image format for the Web by buzzkills on Sunday March 23, 2014 @05:11AM (#7452665)
It took longer than that for png to stick.
Re:WebP – A new image format for the Web by threeseed on Sunday March 23, 2014 @09:03AM (#7453163)
You missed my point. Technology is not the reason WebP is probably going nowhere.

Apple, Microsoft and Firefox for whatever reason (politics/principle) either won't support defacto standards or have to be dragged kicking and screaming into doing so (see SPDY). And without those three you are never going to get above 45%.

Re:WebP – A new image format for the Web by emilis_info on Sunday March 23, 2014 @11:06AM (#7453586)
How can you call things unsupported by the majority of players in the market "defacto standards"?
Re:WebP – A new image format for the Web by clarry on Sunday March 23, 2014 @11:33AM (#7453674)
On top of that, SPDY is an experimental protocol that may eventually (after enough iteration) make it into a standard (HTTP 2.0). It's not standard yet, and definitely not defacto standard.
Re:WebP – A new image format for the Web by cpeterso on Sunday March 23, 2014 @12:40PM (#7453950)
Mozilla's adoption of SPDY shows that they (we) are not dogmatically refusing Chrome innovations.
Re:WebP – A new image format for the Web by eurleif on Sunday March 23, 2014 @03:54AM (#7452530)
If it's sufficiently better than the current technology to overcome the switching costs, it sticks.