Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Photo layout

Reply
Thread Tools

Photo layout

 
 
Stephen Boulet
Guest
Posts: n/a
 
      06-27-2005
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
 
Reply With Quote
 
 
 
 
Terry Hancock
Guest
Posts: n/a
 
      06-27-2005
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

 
Reply With Quote
 
 
 
 
Larry Bates
Guest
Posts: n/a
 
      06-27-2005
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

 
Reply With Quote
 
Miki Tebeka
Guest
Posts: n/a
 
      06-27-2005
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 <(E-Mail Removed)>
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-----

 
Reply With Quote
 
stephen@theboulets.net
Guest
Posts: n/a
 
      06-28-2005
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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Choosing Layout: Css-Layout or Table-Layout hpourfard@gmail.com ASP .Net 1 06-19-2006 10:06 AM
CSS Layout question - how to duplicate a table layout with CSS Eric ASP .Net 4 12-24-2004 04:54 PM
Oppinion regarding grid layout vs flow layout NWx ASP .Net 4 02-19-2004 08:56 PM
Converting from grid layout to flow layout. RobertH ASP .Net 1 11-04-2003 12:43 AM
DataList inside a Grid Layout Panel (<DIV>) item layout problem Rick Spiewak ASP .Net 3 08-26-2003 04:22 AM



Advertisments