By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,931 Members | 1,976 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,931 IT Pros & Developers. It's quick & easy.

Photo layout

P: n/a
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
Jul 19 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
On Sunday 26 June 2005 10:57 pm, Stephen Boulet wrote:
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.

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks http://www.anansispaceworks.com

Jul 19 '05 #2

P: n/a
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

Stephen Boulet wrote:
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

Jul 19 '05 #3

P: n/a
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 <mi*********@zoran.com>
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)

iD8DBQFCwCxj8jAdENsUuJsRAt6LAKCrvyG5qZhukUbJsuYqIQ Sub5TkJACbBsbN
yFmfWU5x90DE37MO/NRO3tA=
=WhbL
-----END PGP SIGNATURE-----

Jul 19 '05 #4

P: n/a
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,15 0)

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

Larry Bates wrote:
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

Stephen Boulet wrote:
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


Jul 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.