[reportlab-users] Image Flowable and Raster Image Dimensions 1pt != 1px?!

Andy Robinson andy at reportlab.com
Fri Jan 22 10:00:29 EST 2010


2010/1/22 Rich Andrews <randrews at skylineinnovations.com>:

>

> To produce an image of  50x50 (for example) and expect to display it 50x50,

> you have to expect that the image is going to be displayed somewhere around

> 50x50 in the pdf. And that is the mess.


In your original post I thought you said it was drawing the image in a
rectangle different to what you specified, but I presume that's not
the case. If you specify width and height of 50 in our API, I expect
it to stretch/squash the bitmap to fit in exactly 50x50 point space.
It doesn't matter if the image size in pixels is 20x20, 1500x1500, or
20x1500.


> Rather, producing a raster image of 1500x1500 and displaying it in a

> Flowable Image of 50x50 is the way to go.


30x - that's fairly extreme! If you're creating documents for high
quality print, you'll probably know how many DPI you need and there
may be rare cases when you need this, but the consequence will be a
large file size (as the images are embedded).

If it's documents for web use or viewing onscreen, and the images are
photos, there is a tradeoff between quality and download speed, and
you don't really need that many pixels - the color graduations are
more important. We tend to use a 2-for-1 rule in ReportLab's
solutions. Thus, if the PDF design calls for a 200 point wide image
(say, to fit in one column of a 2-column brochure), a 400-pixel wide
photo will probably look good enough to most people.


- Andy


More information about the reportlab-users mailing list