[Image-SIG] Unsharp Masking and Gaussian Blur for PIL

Kevin@Cazabon.com kevin@cazabon.com
Sat, 25 Jan 2003 16:52:07 -0700

Hey everyone;

I've written a DLL for PIL that does proper Gaussian Blur and Unsharp
Masking (sharpening).  It's pretty quick, and the results are a LOT more
pleasing, powerful and configurable than the standard sharpen/blur functions
in PIL.

It's currently released under LGPL in the stand-alone form.  A zip of the
C++ source, Python wrapper module, and a pre-built Windows binary is
available from:  http://www.cazabon.com/pyCMS/downloads/PIL_usm_0.1.0.zip

FRED:  if you're willing to put this in the core PIL library (I hope so!),
let me know and I'll gladly send you a license-less version (as long as you
maintain my contact info in the code of course).

The functions work for RGB, RGBA, RGBX, and CMYK, mode images only  (It is
supposed to support L mode too, but I have some work to do there still,
probably in version 0.2.0).  If you've ever used Gaussian Blur or Unsharp
Masking in Photoshop, this works EXACTLY the same way.  I'll write up a
short explanation for those that haven't and post it soon.

If you use the .py wrapper module, it's pretty simple:


import Image
import PIL_usm

a = Image.open("c:\\temp\\test.tif")
b = PIL_usm.gblur(a, radius = 5)    # gaussian blur function
c = PIL_usm.usm(a, radius = 5, percent = 150, threshold = 3)    # unsharp
masking function