Last Updated: 20-August-2015

So having recently got married, my Mrs wanted all the wedding photos turning into grey scale, I originally planned to do this with pixlr.com one at a time as I thought she only wanted a few doing - it turned out to be all of them and there are around 600 of them!

I took this as an opportunity to extend my python knowledge and I ended up with this...


from PIL import Image, ImageFilter
import glob

try:
    for files in glob.glob('*.*'):
        im = Image.open(files).convert('L')
        print files
        im.save("grey_" + files)
except:
    pass

This runs through all images in the directory the script is ran in and makes a grey scale version of each with the file name grey_original_file_name.jpg

About the author

Image

Craig Addyman @craigaddyman
Head of Digital Marketing. Python Coder.