PIL Convert Alpha-transparent image to non-transparent?

Chander Ganesan <[email protected]>
Newsgroups gmane.comp.python.image
Message-ID <[email protected]>
Hi Folks,

I've done quite a bit of searching on Google for this and have yet to
find a working result, so hopefully someone here will know...

I've got an image that has alpha transparency, it has a non-white
background color (that is transparent), and several pixels are
"partially" transparent.  If I take the image and convert it over from
RGBA to RGB, the text in the image looks "blocky".

I need to convert the image to a non-transparent one (so I can pass it
into tesseract for OCR) but I cannot seem to do so without loosing
quality of the text in the image.  Is there a standard way to do this?
I've tried the following (all to no avail):

- Iterate over the pixels and find those that are more than 50%
transparent and convert them to white (ends up with a dithered image)
- Use Paste onto a white background that has no transparency, and then
convert to RGB (no luck there)
- Use Image.blend to attempt to blend with a white background (at
various levels), no luck there.

Any help - or pointers in the right direction - would be much appreciated!

Thanks!

chander

_______________________________________________
Image-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/image-sig
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.