I am trying to process JPEG images that contain two letters that are nearly black, on a background that is nearly white. I have managed to make the letters fully black, and the background fully white by using white-threshold and black-threshold. However, the images also have little "squiggles" in them that are a darker gray color. I am wanting to remove these, and make them just white. Therefore, I was wondering if there is any way to, after fixing the letters and the background, just make all pixels that are not black, white. I have tried setting the white-threshold to 100%, but that does not work. Any other ideas?
And yes, this is a CAPTCHA, but this is just an experimental project. I am not hacking anything.
[SOLVED] Convert non-black pixels to white
[SOLVED] Convert non-black pixels to white
Last edited by dstrout on 2010-10-26T11:53:53-07:00, edited 1 time in total.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Convert non-black pixels to white
First, to get pure black and white and no grays, you want to just use -threshold.
Second, if you really want to change all colors that are not say black to white, then use -fill white +opaque black
see
http://www.imagemagick.org/script/comma ... #threshold
http://www.imagemagick.org/script/comma ... php#opaque
Second, if you really want to change all colors that are not say black to white, then use -fill white +opaque black
see
http://www.imagemagick.org/script/comma ... #threshold
http://www.imagemagick.org/script/comma ... php#opaque
Re: Convert non-black pixels to white
Thank you very much! That did the trick. Oh, and BTW, I knew I could just use -threshold, but I needed to set individual thresholds for black and white, otherwise it didn't work properly.
Thanks again!
Thanks again!