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

Rich Andrews randrews at skylineinnovations.com
Fri Jan 22 09:45:33 EST 2010


I've come across my answer, which required conceptual understanding of pdfs
and scaling.

Embedded raster images need enough pixel data so as to work well in the pdf
environment.

Producing images with pixel for point accuracy is the incorrect approach.
Rather, the raster image should have a higher pixel density than the
Flowable Image width and height.

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.

Rather, producing a raster image of 1500x1500 and displaying it in a
Flowable Image of 50x50 is the way to go.


On Thu, Jan 21, 2010 at 12:56 AM, Rich Andrews <
randrews at skylineinnovations.com> wrote:


> So far so good with ReportLab/PLATYPUS but I've stubbed my toe one

> something and can't find a solution in the doc/forum. And this is no doubt

> obvious.

>

> An image, images/SampleGraph1.gif, is created in the filesystem: 50 by 50

> pixels; 72 PPI (per GIMP). Both gif's and png's exhibit the observed

> behavior.

>

> A Flowable is subsequently constructed with the image.

> Image('images/SampleGraph1.gif', 50, 50)

>

> The image renders in the PDF larger than 50x50 it renders at about 77x77.

>

> So if I construct the Flowable at (50/77) 32.45 x 32.45 things look proper

> in the PDF.

>

> Where I'm stuck is that if my image is 72 pixels per inch and there are 72

> points per inch, then shouldn't things be 1 pixel per 1 point? If so, I

> should be constructing the Image Flowable with 50x50.

>

> Thanks in advance!

>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20100122/72a28771/attachment.htm>


More information about the reportlab-users mailing list