>Hi Al.
>I'm using an OCR DLL to extract the text from an images.
>The text in these images are always black. The black color is only used in the text part.
>So, to improve the OCR results, I need to remove all non black pixels or change them to white, and save this "new image".
You may want to reduce the image to a single bitmap. First off, what you think is black is just close to black but not exactly so.
Any decent image manipulation program has this option (reduce bitmap, posterize) or perhaps a luminance graph where you can adjust the curve to enhance the contrast. I'm doing such things in Gimp (freebie, open source) and the results look fine to me... but it's not me who it has to look good for, it's the OCR software. And I'm sure the software is already deciding its best based on the difference between the lighter and darker areas, no matter how far from white and dark they are. You may try posterizing and submit the result to your OCR, but I'm not sure it would help it. What's more important for OCR is that the light is uniform, so that the whites on one side of the page are not as dark as the blacks on the other side; that the resolution is sufficient; that the print is sufficiently different from the paper (just try scanning the ingredients on a chocolate wrapper... turquoise on purple in 4px font).