[Django]-How to generate a filmstrip image in python from a folder of images?

1👍

Here is a function that wraps the contact sheet function S.Lott mentioned.

#!/usr/bin/env python

import os, os.path
from contactsheet import make_contact_sheet

def make_film_strip(fnames,
                   (photow,photoh),
                   (marl,mart,marr,marb),
                   padding):
    return make_contact_sheet(fnames,
                              (1, len(fnames)),
                              (photow,photoh),
                              (marl,mart,marr,marb),
                              padding)

It is assuming the recipe is saved as contactsheet.py. Usage is:

fstrip = filmstrip.make_film_strip(filmstrip.fnames, (120, 120), (0,0,0,0), 0)
fstrip.save('/path/to/file.format')

Tested.

👤muhuk

4👍

Do you mnean something like this? Use PIL to make a “contact sheet” of images?

Perhaps there are others here that are closer to what you want: http://code.activestate.com/recipes/tags/graphics/

👤S.Lott

Leave a comment