[Image-SIG] adding overlay & text to many files

Bernard Rankin berankin99 at yahoo.com
Wed Jan 14 16:26:45 CET 2009


I'm sure this must be a common question, but I could not find any docs on this.  Perhapse my google skills needs improvment.

Basically, I've got a bunch of pictures from a party/event that I want to do several things to:

1)  Resize to 4x6 @ 300 PPI 
2)  Add a slightly translucent ~ 1" white bar on top of the image (across the bottom).
3)  Over the white bar, on the left, place a small 1"x1" logo.
4)  Over the white bar, centered on the remainder, put the names of the people in the photo. (Reducing text size if needed to fit on one line.)
5)  Over the white bar, centered on the remainder, put the name of the event on the next line.
6)  Add a black border to entire image.
7)  Export as JPEG.

There is a CSV file that contains the "names of the people in each photo" to file name mapping.  (One line per image file.)

Can this be automated with the PIL?

The biggest challenge I imagine would be the step 4 that needs to auto-resize text to fit in a certain area....  That is, it's a single-line text box such that the text inside starts out at some desired size, but is
automatically shrunk (in font size) to fit the width of the box if the
supplied text is too long.

Additionally, for the overlay, it would be nice to use a GIMP file with dummy text as a template that I can supply the correct text and base image file.  Is this possible with PIL?

Thank you,


More information about the Image-SIG mailing list