Forum Bugs

PNG image scaling problem

jccameron
Hi, it looks like there is a bug in the scaling code for PNG files. These are exactly the same images but in three different formats.

Take a look at this code and see how it is rendered in Prince:

<p>PNG as background image</p>
<div style="border: 1px solid black; width: 192px; height: 19px; background-image: 
url(http://www.james-cameron.org/media/img/component_ratings/cr-bg-great.png);background-position:0 0; background-repeat:no-repeat; "></div>

<p>JPG as background image</p>
<div style="border: 1px solid black; width: 192px; height: 19px; background-image: 
url(http://www.james-cameron.org/media/img/component_ratings/test.jpg);background-position:0 0; background-repeat:no-repeat;"></div>

<p>GIF as background image</p>
<div style="border: 1px solid black; width: 192px; height: 19px; background-image: 
url(http://www.james-cameron.org/media/img/component_ratings/test.gif);background-position:0 0; background-repeat:no-repeat;"></div>

<p>PNG as inline image</p>

<img src="http://www.james-cameron.org/media/img/component_ratings/cr-bg-great.png" />

<p>JPG as inline image</p>
<img src="http://www.james-cameron.org/media/img/component_ratings/test.jpg" />

<p>GIF as inline image</p>
<img src="http://www.james-cameron.org/media/img/component_ratings/test.gif" />


As you can see, whether inline or as a background image, the PNG is scaled down more than the other two images.

Here is a screenshot from the PDF:

mikeday
The PNG file has an intrinsic resolution of 105dpi or thereabouts which determines its size. You can override this by specifying "prince-image-resolution: normal".