Photo layout

S

Stephen Boulet

Is there a python solution that someone could recommend for the following:

I'd like to take a directory of photos and create a pdf document with
four photos sized to fit on each (landscape) page.

Thanks.

Stephen
 
T

Terry Hancock

Is there a python solution that someone could recommend for the following:

I'd like to take a directory of photos and create a pdf document with
four photos sized to fit on each (landscape) page.

Probably you could do this with PIL + reportlab.
 
L

Larry Bates

You can use Python Imaging Library (PIL) and ReportLab to resize and
place the photos on a page quite easily. Actually ReportLab calls
PIL automatically to resize the photos when you call .drawInlineImage
method of the canvas object with the proper width and height arguments.

To get ReportLab go to: http://www.reportlab.org

Note: I'm assuming the photos are in .JPG, .TIF or some format that
PIL can recognize. If they are in some proprietary RAW format you
will need to convert them first.

-Larry Bates
 
M

Miki Tebeka

Hello Stephen,
I'd like to take a directory of photos and create a pdf document with
four photos sized to fit on each (landscape) page.
Use LaTex (pdflatex that is, see www.tug.org). It know how to embed
pictures and how to resize them.

Bye.
--
------------------------------------------------------------------------
Miki Tebeka <[email protected]>
http://tebeka.bizhat.com
The only difference between children and adults is the price of the toys

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (Cygwin)

iD8DBQFCwCxj8jAdENsUuJsRAt6LAKCrvyG5qZhukUbJsuYqIQSub5TkJACbBsbN
yFmfWU5x90DE37MO/NRO3tA=
=WhbL
-----END PGP SIGNATURE-----
 
S

stephen

Thanks! This works well -- I was letting myself be too intimidated with
reportlab before looking at the documentation, but it was really not
hard at all. I think I figured out how to do landscape mode too.

from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import letter

def insertPicture(c):
.....c.drawInlineImage("geese1.jpg",100,100,200,150)

width, height = letter
letter = height, width # change to landscape
c = canvas.Canvas("picture.pdf",pagesize=letter)
insertPicture(c)
c.showPage()
c.save()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top