Python PDF + Pictures

Stefan Behnel stefan_ml at behnel.de
Tue Mar 11 07:44:45 EDT 2008


durumdara at gmail.com wrote:
> I have many photos, and I wanna make some "presentation" from these
> photos, a "thumbnail" like document with one image per one page.
> 
> If I wanna make one document now I do this:
> I execute a python script that create a html site with resized pictures,
> and split this html site to 50 images per one html file.
> Next I open these files in OpenOffice Writer by hand, and save them as
> PDF document with poor quality (image compression 95%, image DPI 75).
> This generates a medium sized PDF documents (2,5 - 5,6 MB for each) that
> can opened everywhere (because of PDF format).
> 
> But I wanna automatize this process with python.
> The technic that I will use is this:
> 1.) Collect the files in dirs.
> 2.) I process one dir in one time.
> 3.) I get the files.
> 4.) I resize them to max. 1024/768.
> 5.) I put the actual image file to the PDF document.
> 6.) After each 50. file I open new numbered PDF.
> 7.) Every picture placed in one page, and every page orientation set up
> as the picture orientation (Portrait or Landscape).
> 
> The PDF must be parameterized to image compression 95%, and 75 or 96 DPI.

PIL can write PDFs, and it's clearly a good choice for image processing.

http://www.pythonware.com/products/pil/

Stefan



More information about the Python-list mailing list