[whatwg] <img srcset> for responsive bitmapped content images

Tab Atkins Jr. jackalmage at gmail.com
Thu May 10 07:19:13 PDT 2012


On Thu, May 10, 2012 at 3:47 PM, Simon Pieters <simonp at opera.com> wrote:
> On Thu, 10 May 2012 15:24:28 +0200, Tab Atkins Jr. <jackalmage at gmail.com>
> wrote:
>> CSS3 Images has the image-resolution property, which lets you tell the
>> browser what resolution to display the image at (that is, how it
>> should determine the automatic size).  You can say "image-resolution:
>> from-image;" to get it to use the image's native resolution, whatever
>> it is.  So, we need to add a rule to the UA stylesheet that says
>> "img[srcset] { image-resolution: from-image; }".
>
> Do we want from-image here? Or do authors prefer to serve 96dpi images that
> are bigger, and specify the intended dpi in the markup?

Can you clarify what you mean by this?  Do you mean serving a 10inch
wide image at 96dpi rather than a 5inch wide image at 192dpi, and then
telling the browser to scale it by the x factor?

The two are identical in the image's data (they're all 960 pixels
wide), only the metadata differs.

I suspect both:
1. A lot of authors would find it very confusing if they couldn't save
an image at 300dpi and have it just work, and
2. A lot of authors will be confused to discover that that they have
to save their image as 300dpi to get it to work.


>> For two, I'm not sure that it's particularly obvious that when you say
>> "2x", you should make sure your image was saved as 196dpi.  You have
>> to already know what the default resolution is.  As well, I think that
>> values like 300dpi are pretty common, and they don't map to integral
>> 'x' values.  If people say "screw it" and use "3x", this'll be
>> slightly wrong and I think will cause ugly blurring.  If we make this
>> take <resolution>, people can just use the dpi unit.
>
> Can we just use CSS's 'dpi' instead?
>
> <img src="default.jpg" srcset="highres.jpg 300dpi">

If you take dpi, you might as well take all of the <resolution> units.
 There's only 3 so far - dpi, dpcm, and dppx.  There's no good reason
to limit to only one of them, since they're all constant multiples of
each other.

~TJ



More information about the whatwg mailing list