O'Reilly logo

Python 2.6 Graphics Cookbook by Mike Ohlson de Fine

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Filter effects: blur, sharpen, contrast, and so on

PIL has an ImageFilter module that has a useful selection of filters for enhancing certain characteristics of images such as sharpening features that were blurred. Ten of these filters are demonstrated in the following recipe.

Getting ready

Use the images russian_doll.png from the folder /constr/pics1. Create a folder /constr/picsx for the resulting filtered images. Using a separate folder for the results helps prevent the folder pics1 from becoming overcrowded with a heap of redundant images and work-in-progress. After each execution, we can delete the contents of picsx without the fear of losing source images for the recipes.

How to do it...

Open the folder /constr/picsx on your screen before you ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required