Forum How do I...?

Image-resolution seems to be based on 96dpi

jerkob
I am trying to use both regular images (img tag) and background images that I have created at 72dpi but four times larger than I'll use them - i.e. if I want 16x16 output, I create it at 64x64 and 72dpi and then in my CSS I set image-resolution to 288dpi (72dpi times 4).

My understanding is that this should bring it down to the size I want (16x16 in my example). However, in practice the resolution that makes it the correct size is a multiple of 96 (i.e. image-resolution: 384dpi).

Am I doing something wrong? Am I misunderstanding something? I want to understand how this works before I move forward making a lot of PDF-specific images.
mikeday
Prince converts pixel units in CSS to physical units assuming 96dpi. So "96px" is equal to "1in". If you exclusively use pixel units or exclusively use physical units then there is no confusion. But if you use both in the same document, you need to keep in mind the conversion factor of 96px/in.
mikeday
I forgot to mention that the next release of Prince will support the new background-size property, which may be easier to use than adjusting the image resolution.
jerkob
Mike, thank you for your quick response. This makes sense, and I now realize that my previous thinking didn't really make much sense (if the DPI isn't embedded in the file and I tell Prince that the DPI is 288 then how is Prince supposed to know that it was originally 72?).