Forum How do I...?

Image resolution (intrinsic, prince-image-resolution)

arlenb
I've read the existing topics, but don't seem to see a clear answer.

1. If using CSS I set a width and height on the image tag, Prince prints the image at that size

2. If I set no width with CSS, the image is sized based on its intrinsic resolution (set when saved in Photoshop)

Here are my questions:

1. Is it this possible to override the intrinsic image resolution by applying style="prince-image-resolution: 300dpi" directly to the image tag? If so, I must be doing something wrong because I can't get prince-image-resolution to do anything at all.

2. Is prince-image-resolution supposed to override the interpreted resolution when I do have width and height defined in the style attribute/stylesheet?

Ideally, I'd like to be able to set a width and height in the style attribute/stylesheet (to set how much space it takes up on the page) and then set prince-image-resolution to set what dpi the image actually prints at. The quality of the end result would depend on what the real dimensions were relative to the size on page and the prince-image-resolution I set.

Right now it looks like I will just always have to make my images exactly the right size/dpi by default and forget about prince-image-resolution being a magic fix.

Looking forward to some clarity. Thank you!
mikeday
It doesn't make sense to specify width/height for an image and set the image resolution as well, as the image resolution is only used as a way of determining the physical size from the number of pixels when no explicit physical size has been specified.

For example, if the image is 300 pixels wide and 300 pixels tall and you specify a resolution of 300dpi then the image should be displayed as a 1 inch square. If you specify 600dpi then the image will be 0.5 inch square.

If you specify an explicit width and height then the resolution will not be used, as there is no need for it.
arlenb
So basically, if I just set the dpi I want in Photoshop/other when exporting the image, and then set the appropriate amount of space the image should take up on the page in the stylesheet (e.g. if 300 dpi and a 300x300 image, it should be 96x96 pixels), I should get the desired results (a 300dpi 1x1 inch image)?
mikeday
You can specify measurements in physical units in your style sheets, eg. "1in", "2.54cm", "25.4mm", etc. This can be clearer than using pixels, which don't have an obvious interpretation when applied to paper.