Hello,
i am new on this forum,hello every body,
I want to convert a .jpg image in a .pbm binary image.
I 'll like to select only the blue pixels to fill them with black, and let all the other in white. is it possible with Image magick?
I have read all the subjects with "pbm" and cannot find an answer.
Thanks a lot.
select blue pixel and generate pbm
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: select blue pixel and generate pbm
I am not sure what colors you have in your image. If there are other near shades of blue that you want to include then you need to use -fuzz. If pure blue only, then it can be left out or use -fuzz 0%. Try this
convert image.jpg -fuzz 10% -fill white +opaque blue -fill black -opaque blue result.pgm
you fill the non blue with white using -fill white +opaque blue and you then fill the blue with black using -fill black -opaque blue. then set the image type to pgm (graylevel, which will be binary b/w).
see
http://www.imagemagick.org/Usage/color_basics/#opaque
http://www.imagemagick.org/script/comma ... php#opaque
http://www.imagemagick.org/script/comma ... s.php#fuzz
convert image.jpg -fuzz 10% -fill white +opaque blue -fill black -opaque blue result.pgm
you fill the non blue with white using -fill white +opaque blue and you then fill the blue with black using -fill black -opaque blue. then set the image type to pgm (graylevel, which will be binary b/w).
see
http://www.imagemagick.org/Usage/color_basics/#opaque
http://www.imagemagick.org/script/comma ... php#opaque
http://www.imagemagick.org/script/comma ... s.php#fuzz
Re: select blue pixel and generate pbm
Thanks a lot, for the links also. It seems to run quiet well, even on the complex image (botanical image) I am working on.
Yog
Yog