[Image-SIG] PIL Convert Alpha-transparent image to non-transparent?

donn donn.ingle at gmail.com
Tue Jul 6 06:25:34 CEST 2010


I'm no PIL expert, but some thoughts:

> - Iterate over the pixels and find those that are more than 50%
> transparent and convert them to white (ends up with a dithered image)
Why not choose a range of gray values white to black, say in steps of 10%?

> - Use Paste onto a white background that has no transparency, and then
> convert to RGB (no luck there)
That's a good plan. Did you display (img.show() )the image to see the 
effect of the paste? Perhaps there is some mistake in the operation.

> - Use Image.blend to attempt to blend with a white background (at
> various levels), no luck there.
Ah, ok, good plan again. Still, check that image out visually.

I don't know tesseract, but perhaps closer reading of the docs will 
reveal something you are missing in re the RGB format.

Another idea would be to try using Gimp automation, employing Gimp as 
your muscle.

\d


More information about the Image-SIG mailing list