Forum How do I...?

Blurry images when viewing on screen

trevordevore
I have been experimenting with Prince and have noticed that the images in the generated PDF files on screen are often blurry. I saw this same behavior in another PDF library I used to use and the solution we found was to use integers for the coordinates as well as the image dimensions. If any fractions were used then the images would appear blurry when rendered on screen.

The library developer incorporated a setting that would cause the library to always trunc() the values before inserting them into the PDF and this solved the problem for on-screen display.

Is there a way that I can ensure the coordinates embedded in the PDF are always integers when using Prince?

Trevor DeVore
Blue Mango Learning Systems
http://www.screensteps.com - http://www.clarify-it.com

mikeday
We don't have any feature like this. What software are you using to view the PDF files, how big are the images, and what format are they?
trevordevore
The images are PNG (screenshots). Sample image sizes are 755x511, 580x347, 748x536, 335x474 and 692x508. I'm printing to an A4 page with image resolution set to the default of 96 dpi.

I'm viewing the PDF in Preview on OS X 10.7. PDF file is generated on OS X.

I have generated PDF files with Prince and my current PDF solution using the same source materials. The images look fine in the PDF created with my current solution. They are blurry with Prince. What I'm seeing looks very similar to what I saw with a PDF library I used to use (prior to feature that coerced coordinates/dimensions to integers). I can provide source material along with the output I'm getting on my end if that would be helpful.

Trevor DeVore
Blue Mango Learning Systems
http://www.screensteps.com - http://www.clarify-it.com

trevordevore
Here is a screenshot showing an example. It has the original image, the Prince generated PDF and the PDF generated by another library. The image in the Prince generated PDF file has issues rendering the subtle drop shadow.

Note: the images in the two PDFs are slightly different sizes as the page margins are different in each PDF. In both cases the image has been reduced in size to fit within the PDF.

Trevor DeVore
Blue Mango Learning Systems
http://www.screensteps.com - http://www.clarify-it.com

  1. FC26FDDD-3CA2-4A36-9AC3-A690A13346D4png.png236.8 kB
mikeday
Would you be able to email me (mikeday@yeslogic.com) the image file? I haven't encountered this issue before, and I'm wondering if it is specific to MacOS X Preview, or whether it affects other PDF viewers. One way to test is to put the image in an otherwise empty document and specify "prince-image-resolution: 72dpi" on the image, which should ensure that it uses exactly integer coordinates.
trevordevore
Done.

Trevor DeVore
Blue Mango Learning Systems
http://www.screensteps.com - http://www.clarify-it.com

mikeday
To support this we have added a new property "prince-image-magic: snap-to-integer-coords", which does exactly what it says. It's available in Prince 8.1. :)