Ask HN: Why srcset and not just progressive JPGs?

3 points by fyrejuggler ↗ HN
These days I often use devices with high DPIs. Some auto-scale websites up, on other devices I use tools like NoSquint that sets a default zoom. So more and more often I wish the images on my sites had a higher resolution.

Looking into the documentation of srcset, I wonder why all the complexity. Couldn't we just use progressive JPGs and the browser loads until it has all the pixels it needs for the image in the current situation (screen dpi, zoom level, css scaling etc).

1 comment

[ 3.1 ms ] story [ 12.4 ms ] thread
The roundtrip latency means the server will send more packets than you really need, and it'll have read more data off disk than it actually sends. The client has all the information about dpi up front, so it has the ability to make a precisely described request up front. Also, you'd have to make your images be JPEGs, and use tools that generate the kind you need.

I also don't see what complexity you see. Instead of specifying one URL, you specify a small family of them. That's not architecturally more complicated -- it's a change of datatype. The behavior's straightforward and the presence of multiple versions of images is highly visible, instead of being a detail of some binary file.