Re:Building a New Image Format
by lobster_johnson on Wednesday November 21, 2012 @09:53AM
(#4814424)
This makes very little sense. The article suggests that you bundle many sizes of the same image into the same file; say, a 1024x1024 version as well as a 512x512 version. This means that a browser that only wants the 512x image will also download the 1024x image whether it wants to or not. So why not just pick the 1024x image and resize it on the client size, if everyone is going to download it? This is something that today's chips do very fast. At 2x resolutions you can even skip interpolation and just go for nearest-neighbour scaling.
[ Parent
| on HN ]
Maybe it could be in a stream [headers][512px data][1024px data] and you could stop after the [512px data]. And since 512px image is a subset of 1024px one, you could do [headers][512px data][1024px\512px data] and so on.
(Just a guess.)
You've basically just described interlacing. For instance, interlaced PNGs start with a 1/8 scale pass/frame and fill in the remaining pixels with the following 6. (Frames 1-5 would be required for a 1/2 scale image.)
Re:Building a New Image Format
by lobster_johnson on Wednesday November 21, 2012 @11:13AM
(#4814778)
Unfortunately, because of buffering I believe this would still be inefficient. Also, it would screw up HTTP keepalive. A better way would be for the browser to fetch the header first by using the HTTP "Range" header, and then fetch the subrange it needs, but that adds one roundtrip just to get an image.
>At 2x resolutions you can even skip interpolation and just go for nearest-neighbour scaling.
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.
Re:Building a New Image Format
by lobster_johnson on Wednesday November 21, 2012 @11:10AM
(#4814763)
Depends very much on the size. The resulting edginess becomes much more pronounced the fewer pixels you have. I'm just pointing out that in some cases you can conserve CPU usage by cheating. You could render a shoddy version first just to get the page up, for example, and then replace it with a high-quality version; some browsers already do this today.