Splitting a contact sheet

When I received a CD containing contact sheets from my photographer, I was in a hurry to put the photos online. He had promised to send me another CD containing individual photos later, when the printing for the album was completed.

I tried to use normal software like Photoshop to do the trick, and looked for tools online. While there were a number of tools to create a contact sheet, there were none to take it apart. Strange.

After thinking, I was able to write a small Python program to do the trick. I am sharing it for the benefit of everyone, releasing it under GNU GPL. Download Python and run it like: python split.py Contact.jpg (where split.py is a file containing the code below and Contact.jpg is the contact sheet).
Download split.py here.

Here, the contact sheet is 1000×800 pixels, and I want to split it into 5 parts horizontally and 4 parts vertically. These parameters need to be changed in the first four lines as per need.

I noticed that since the contact sheet was JPG, and the output was also JPG, it was causing degrading in quality. So, I changed the output format to BMP, and then reconverted back to JPG using other software.

Share

Licensing and information about the blog available here.