[Image-SIG] Calling img.filter(ImageFilter.SMOOTH) destroys partially-transparent alpha?

James virtue at rocketmonkeys.com
Sat Oct 1 18:30:37 CEST 2011


Sorry if this has been covered, I couldn't seem to find anything on it.

I have a transparent PNG file.  I want to render nicely-smoothed,
transparent antialiased text on top of it.  This will be pasted onto
other images, so I can't have the typical background-blended antialias
edges PIL normally does.

I used Ned Batchelder's method
(http://nedbatchelder.com/blog/200801/truly_transparent_text_with_pil.html)
for rendering antialiased text, and that works.

But when I try to run "img.filter(ImageFilter.SMOOTH)", the filter
replaces all semi-transparent values with the background color blended
ones instead.

How can I run a smoothing filter on an image with per-pixel alpha
without destroying it?  Thanks!

-James


More information about the Image-SIG mailing list