[reportlab-users] drawImage makes image roughly twice as big as it should be

Tim Roberts timr at probo.com
Thu Jan 26 12:44:25 EST 2006


On Thu, 26 Jan 2006 08:34:48 +0100, JP Glutting <jpglutting at oqua.udl.es>
wrote:

>
>Thanks. I ended up just using a much larger image, and it scales down 
>well - it just takes up a lot more space in the document.
>

Yes.  It NEEDS to.  Your smaller image doesn't have enough pixels to
render properly on anything but a web site.

>The drawImage 
>function maps one point to one pixel by default: "If width and height 
>are not given, the "natural" width and height in pixels is used at a 
>scale of 1 point to 1 pixel."
>  
>

Right.  What that means is that a 101x75 pixel image will occupying a
rectangle of 101 points by 75 points.  If you happen to view that file
at 100% magnification on a device that has a resolution of 72 pixels per
inch, then it will look as you expect.  Most Windows displays are set
for either 96 dpi or 120 dpi.  Plus, you were probably viewing your PDF
at a magnified view.

PDF files don't work in pixels, ever.  Everything is in real-world
physical units, even when they are displayed on a CRT.

>Unfortunately, I can't create my own logo, since it is the official logo 
>of the university, and I am not handy enough to re-create it, but I will 
>try to get a copy in EPS format.
>  
>

If the higher-res JPEG is acceptable, then there is probably no need to
look for an EPS.

>To clarify - I understand what you are saying about the printer, but the 
>problem was that the image was magnified and looked bad in the Adobe, 
>before it even went to the printer.
>  
>

Right.  There's no real difference between the two.  The screen happens
to have a lower resolution than the printer, but it's still higher than
the 72 dpi resolution you get with the default 1 point : 1 pixel setup,
so it gets stretched.

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the reportlab-users mailing list