Hi,
i have a couple of color TIF images (Green, Pink, and Yellow). i need to convert to black and white through unix command line.
i tried the following:
convert +compress -monochrome ImageName Imageout
convert +compress -type Bilevel ImageName Imageout
commands and they get only converted to grayscale.
My Question is there a command i can run to convert all the images to Black and white without setting a threshold as they differ between images
Thanks
Colour to Black and white
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Colour to Black and white
try changing the order of your commands to the proper syntax with the input before the operators. see http://www.imagemagick.org/Usage/basics/#why
try
convert imagein.tif -colorspace gray -colors 2 +dither -type bilevel imageout.tif
or
convert imagein.tif -monochrome -type bilevel imageout.tif
but monochrome will always dither.
be sure to save your result as tif as gif and png may not support bilevel image types
see
http://www.imagemagick.org/Usage/quantize/#monochrome
http://www.imagemagick.org/Usage/quantize/#two_color
By the way, your message probably should have been posted to the User's forum, but not a big deal
try
convert imagein.tif -colorspace gray -colors 2 +dither -type bilevel imageout.tif
or
convert imagein.tif -monochrome -type bilevel imageout.tif
but monochrome will always dither.
be sure to save your result as tif as gif and png may not support bilevel image types
see
http://www.imagemagick.org/Usage/quantize/#monochrome
http://www.imagemagick.org/Usage/quantize/#two_color
By the way, your message probably should have been posted to the User's forum, but not a big deal
Re: Colour to Black and white
Hi Thanks for that
unfortunately the pink and the green color came out completely white using the second command
and the first command shows no image
unfortunately the pink and the green color came out completely white using the second command
and the first command shows no image
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Colour to Black and white
Post a link to your image and explain what you would like to have happen and I will experiment with it. But thresholding in various methods is tricky and image dependent.
You can try some of my various (bash unix) thresholding scripts (although they may not necessarily set the type to bilevel, they will result in black and white only). So you may need to change to grayscale first (-colorspace gray) and set the type to bilevel afterwards (-type bilevel)
see my web site link below and also http://www.fmwconcepts.com/imagemagick/ ... /index.php
It is late for me now, so I will try tomorrow if you post a link to your image(s).
You can try some of my various (bash unix) thresholding scripts (although they may not necessarily set the type to bilevel, they will result in black and white only). So you may need to change to grayscale first (-colorspace gray) and set the type to bilevel afterwards (-type bilevel)
see my web site link below and also http://www.fmwconcepts.com/imagemagick/ ... /index.php
It is late for me now, so I will try tomorrow if you post a link to your image(s).
Re: Colour to Black and white
Hi,
i am working on getting those images for you ...really appreciate your help
i am working on getting those images for you ...really appreciate your help