[Image-SIG] PIL TIFF to PDF conversion

Terry Hancock hancock@ipac.caltech.edu
Fri, 19 Jul 2002 11:33:34 -0700 (PDT)


Evidently PIL is assuming 72 dpi, which is a common
default.  So it's not preserving the DPI information
when you process it. I flipped through the manual
just now, but didn't find out if you can set the
DPI for saving to PDF.

You can use im.resize() to scale to the desired
size for 72dpi, but you'll lose some resolution
compared to the original.

(Hopefully there's a better answer)

Terry

--
------------------------------------------------------
* Terry Hancock -- Science Software Support  -- IPAC *
*            http://www.ipac.caltech.edu/            *
*              hancock@ipac.caltech.edu              *
------------------------------------------------------

On Fri, 19 Jul 2002, Larry Bates wrote:

> I'm having problems with a very simple application (see below):
>
> #----------------------------
> from PIL import Image
> #
> # Read in 8.5 x 11 inch TIF invoice scanned at 100 dpi
> #
> im=Image.open("c:\\test\\invoice.tif")
> #
> # Save it in PDF format
> #
> im.save("c:\\test\\invoice.pdf","PDF")
> #----------------------------
>
> The problem is that the PDF that is output by PIL is
> 11.81 x 15.28 inches in size.  If I open the TIF
> file in PhotoShop it shows 100 dpi, 8.5 x 11 inches.
>
> I don't understand what is happening or why.
>
> Thanks in advance for any assistance.
>
> Regards,
> Larry Bates