Photo layout

Discussion in 'Python' started by Stephen Boulet, Jun 27, 2005.

  1. 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
    Stephen Boulet, Jun 27, 2005
    #1
    1. Advertising

  2. 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
    Terry Hancock, Jun 27, 2005
    #2
    1. Advertising

  3. Stephen Boulet

    Larry Bates Guest

    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
    Larry Bates, Jun 27, 2005
    #3
  4. Stephen Boulet

    Miki Tebeka Guest

    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 <>
    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-----
    Miki Tebeka, Jun 27, 2005
    #4
  5. Stephen Boulet

    Guest

    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()

    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
    , Jun 28, 2005
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rick Spiewak
    Replies:
    3
    Views:
    3,125
    Rick Spiewak
    Aug 26, 2003
  2. RobertH
    Replies:
    1
    Views:
    705
    Steve C. Orr [MVP, MCSD]
    Nov 4, 2003
  3. NWx
    Replies:
    4
    Views:
    2,947
    Kevin Spencer
    Feb 19, 2004
  4. RC
    Replies:
    2
    Views:
    455
    John M Deal
    Nov 24, 2004
  5. Replies:
    1
    Views:
    557
    John Timney \(MVP\)
    Jun 19, 2006
Loading...

Share This Page