How can I convert a JPEG photo to black and white (not grayscale) image like output of a FAX scanner, by ImageMagick?
Asked
Active
Viewed 4.8k times
4 Answers
24
According to this forum post:
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).
msnfreaky
- 113
Oliver Salzburg
- 89,072
- 65
- 269
- 311
12
According to this answer here:
If you have imagemagick installed:
true grayscale only:
convert source.jpg -colorspace Gray destination.jpg
true black and white:
convert source.jpg -monochrome destination.jpg
separate into gray channels:
convert source.jpg -separate destination.jpg
Gabriel Staples
- 2,558
1
I believe that Netpbm's pamthreshold is a much faster and more flexible solution.
For TIFF files, I do
$ tifftopnm test.tiff | pamthreshold | pamtotiff > bitonal.tiff
For Jpeg files you can do
$ jpegtopnm test.jpeg | pamthreshold | pamtotiff > bitonal.tiff
Pamthreshold is rather powerful (take a look at its man page).
Maxim
- 1,704
- 13
- 13