How to make black and white image?
How to make black and white image?
Function monochrome doesnt work since it making it picture look weird.I think proper function will be channel,but i dont know what i need to type exactly.For example in program gimp making black/white picture is called desaturate/lightning
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to make black and white image?
I am not sure what you mean by "black and white"? Two colors only?
If you want grayscale from color, you can type:
convert <input> -colorspace Gray <output>
or
convert <input> -type Grayscale <output>
These will convert color to gray.
However, if you want two colors only (black and white), then you need to threshold, for example, to select the color where above will be white and below will be black
convert <input> -threshold xx% <output>
where xx is in range 0-100 (for percent)
If you want grayscale from color, you can type:
convert <input> -colorspace Gray <output>
or
convert <input> -type Grayscale <output>
These will convert color to gray.
However, if you want two colors only (black and white), then you need to threshold, for example, to select the color where above will be white and below will be black
convert <input> -threshold xx% <output>
where xx is in range 0-100 (for percent)
-
- Posts: 1
- Joined: 2014-06-18T12:39:50-07:00
- Authentication code: 6789
Re: How to make black and white image?
And so does the second one!
convert <input> -type Grayscale <output>
works as well, thanks!
convert <input> -type Grayscale <output>
works as well, thanks!
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How to make black and white image?
For many other methods, see my page on "Making an image grayscale (monochrome)".
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to make black and white image?
As snibgo said, there are many ways and types of color to grayscale conversion. For others on Linux, Mac OS or Windows with Cygwin, I have a script call color2gray at the link below and the page shows examples, also.
Some concepts involved are:
1) -colorspace and type of intensity-like channel (http://www.imagemagick.org/script/comma ... colorspace)
2)-grayscale and one of its intensity settings (http://www.imagemagick.org/script/comma ... #intensity and http://www.imagemagick.org/script/comma ... #grayscale)
3) r,g,b color channel mixing using -color-matrix (http://www.imagemagick.org/script/comma ... lor-matrix) or -separate with -poly (http://www.imagemagick.org/script/comma ... s.php#poly)
Some concepts involved are:
1) -colorspace and type of intensity-like channel (http://www.imagemagick.org/script/comma ... colorspace)
2)-grayscale and one of its intensity settings (http://www.imagemagick.org/script/comma ... #intensity and http://www.imagemagick.org/script/comma ... #grayscale)
3) r,g,b color channel mixing using -color-matrix (http://www.imagemagick.org/script/comma ... lor-matrix) or -separate with -poly (http://www.imagemagick.org/script/comma ... s.php#poly)
Re: How to make black and white image?
I like separating to RGB, then make a mean average (-evaluate-sequence mean) of channel R and G, then a mean average of channel G and B, finally a mean average of those two results, RG and GB, gives it more "life" imo.
Here in color, then normal "-type grayscale", then the method mentioned above.

Reason, I guess, is that there is much more green in the world than red, and especially blue, not much blue around if you look, so by adding more green in the grayscale makes it look more natural, if you can call grayscale natural, but again, that just my opinion.
Here in color, then normal "-type grayscale", then the method mentioned above.

Reason, I guess, is that there is much more green in the world than red, and especially blue, not much blue around if you look, so by adding more green in the grayscale makes it look more natural, if you can call grayscale natural, but again, that just my opinion.
Windows 7 user
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to make black and white image?
Interesting approach.Werty wrote:I like separating to RGB, then make a mean average (-evaluate-sequence mean) of channel R and G, then a mean average of channel G and B, finally a mean average of those two results, RG and GB, gives it more "life" imo.
If I might suggest in the future that you upload 3 separate images rather than one appended one. That makes it easier for the rest of us to download and do comparisons visually or mathematically. Thanks.
Re: How to make black and white image?
Sorry about thatfmw42 wrote:Werty wrote: If I might suggest in the future that you upload 3 separate images rather than one appended one. That makes it easier for the rest of us to download and do comparisons visually or mathematically. Thanks.

Here they are in higher resolution...
Color
http://peecee.dk/uploads/062014/color.png
-type Grayscale
http://peecee.dk/uploads/062014/gray.png
grayRGB
http://peecee.dk/uploads/062014/grayRGB.png
So I do...
convert color.png -channel R -separate R.png
convert color.png -channel G -separate G.png
convert color.png -channel B -separate B.png
convert R.png G.png -evaluate-sequence mean RG.png
convert G.png B.png -evaluate-sequence mean GB.png
Convert RG.png GB.png -evaluate-sequence mean grayRGB.png
Windows 7 user
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to make black and white image?
Thanks for separating the images. Here is unix syntax to do it all in one command.
Code: Select all
convert color.png \
\( -clone 0 -channel RG -separate +channel -evaluate-sequence mean \) \
\( -clone 0 -channel GB -separate +channel -evaluate-sequence mean \) \
-delete 0 -evaluate-sequence mean color2gray1.png
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: How to make black and white image?
Another way of doing the same thing, Windows BAT syntax:
The 3 weights for the R,G,B channels are 0.25, 0.5 and 0.25. These give the same results as the mean of RG and GB means. You can tweak the three numbers, so long as they add to one. (Of even not, if you want.)
Code: Select all
%IM%convert color.png ^
-separate ^
-poly "0.25,1, 0.5,1, 0.25,1" ^
g.png
snibgo's IM pages: im.snibgo.com
Re: How to make black and white image?
Thanks both.
I just sat and starred at the images for 5 mins, and there really is a lot more detail using that method by adding more green, look at the grass and the flowers, more depth and detail.
Also looked at your page snibgo, about grayscale, some interesting results.
I just sat and starred at the images for 5 mins, and there really is a lot more detail using that method by adding more green, look at the grass and the flowers, more depth and detail.
Also looked at your page snibgo, about grayscale, some interesting results.
Windows 7 user
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How to make black and white image?
snibgo wrote:Another way of doing the same thing, Windows BAT syntax:The 3 weights for the R,G,B channels are 0.25, 0.5 and 0.25. These give the same results as the mean of RG and GB means. You can tweak the three numbers, so long as they add to one. (Of even not, if you want.)Code: Select all
%IM%convert color.png ^ -separate ^ -poly "0.25,1, 0.5,1, 0.25,1" ^ g.png
Nice simplification, snibgo!
Glad to see that some one else finds my suggested -poly command useful.