Get Pattern From an Image in PIL Python

Two days ago I needed to generate a PIL image that is made up from repeating a pattern – another PIL image – multiple times, I didn’t find a code online to do it so I just wrote this small code to do it, thought might share it to help somebody out there.

It’s a very simple solution which uses the Image.paste method to repeat the pattern.

You can download this snippet of code from here: https://gist.github.com/4529367.

Enjoy :)

Leave a Reply