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

Simon Pieters simonp at opera.com
Thu May 10 07:28:09 PDT 2012


On Thu, 10 May 2012 16:19:13 +0200, Tab Atkins Jr. <jackalmage at gmail.com>  
wrote:

> 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?

Yeah.

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

Right. I gathered that from-image would use the metadata.

> 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

This is the situation today for <img src>, and I guess we can't change it  
now. We can provide an opt-in, though, that could also work for <img src>  
(like CSS image-resolution).

> 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.

Yeah. Since the author needs to specify the resolution in the markup to  
inform the browser which image to download, we might as well use that  
information since it's more likely to be the intended dpi.

>> 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.

WFM.

-- 
Simon Pieters
Opera Software



More information about the whatwg mailing list