Hacker News new | ask | show | jobs
by alexchamberlain 5152 days ago
But pixel density is a property of the media, which should be dealt with by media queries.
1 comments

Querying the pixel density of the device is not the same as describing the pixel density of the resource. This has been a common misconception in the discussion of this feature.
Apologies - I misunderstood the proposal. However, what is the pixel density of a PNG?
What it's representing is not necessarily an intrinsic property of the image but rather the intended pixel density for presentation. Say I have a 600x200 PNG which fits my design for normal resolution displays where 1 CSS pixel = 1 device pixel (which is most current laptop screens, for instance). But then I'd like to take advantage of the extra resolution on a device that displays at 1 CSS pixel = 2 device pixels, such as a retina display iPad. So then I get a 1200x400 version of the same image (perhaps both downscaled from a super high res original) and serve it as the 2x image. It will take the same logical space in the layout but provide extra quality on a higher resolution display. There's no need to do anything special to the PNG.
Awesome reply. I now understand. This is still a property of the media though.
PPI can be stored in the "pHYs" chunk in a PNG. And some image processing/editing tools do so, such as Photoshop starting with version 7.

http://www.libpng.org/pub/png/book/chapter11.html#png.ch11.d...

http://www.scantips.com/basics9p.html