Hello,
In theory -depth 1 or -colors 2 should work, but after converting the image (png file) I check it with Gimp and it says, it is grayscale, not indexed mode. So -- how can I convert it to black&white? Using IM of course, not Gimp .
Cheers,
How can I convert grayscale image to black&white?
How can I convert grayscale image to black&white?
Last edited by macias on 2010-10-29T10:02:02-07:00, edited 1 time in total.
Re: How can I conver grayscale image to black&white?
trymacias wrote:Hello,
In theory -depth 1 or -colors 2 should work, but after converting the image (png file) I check it with Gimp and it says, it is grayscale, not indexed mode. So -- how can I convert it to black&white? Using IM of course, not Gimp .
Cheers,
-type GrayScale -depth 1
Works for my png graphic.
Greetings, Peter
Re: How can I convert grayscale image to black&white?
Well, it works in sense, that there is an output, but the output is in grayscale, not indexed black&white. I checked it using Gimp.
Just to be sure, I updated ImageMagick to the latest of the latest -- still grayscale (but this time filesize is a bit smaller). But still, the image is not indexed.
Just to be sure, I updated ImageMagick to the latest of the latest -- still grayscale (but this time filesize is a bit smaller). But still, the image is not indexed.
Re: How can I convert grayscale image to black&white?
You are right. How about
-type Palette -depth 1 -define png:color-type=0
-type Palette -depth 1 -define png:color-type=0
Re: How can I convert grayscale image to black&white?
Sorry, again grayscale (wrong color-type number). This should work (hopefully)
-type Palette -define png:color-type=3 -define png:bit-depths=1
BTW: there is a typo in
http://www.imagemagick.org/Usage/formats/#png_write
bit-depth instead of bit-depths
-type Palette -define png:color-type=3 -define png:bit-depths=1
BTW: there is a typo in
http://www.imagemagick.org/Usage/formats/#png_write
bit-depth instead of bit-depths
Re: How can I convert grayscale image to black&white?
This is really not easy. I tested some more and got an indexed 2 colored image with
-type bilevel -define png:color-type=3
This time tested with gimp. Sorry for all the wrong solutions, but I'm a IM beginner.
-type bilevel -define png:color-type=3
This time tested with gimp. Sorry for all the wrong solutions, but I'm a IM beginner.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: How can I convert grayscale image to black&white?
Many of IM's PNG features are not currently working correctly. See viewtopic.php?f=3&t=16490
Re: How can I convert grayscale image to black&white?
Indiego, thanks. Now I get the indexed image.
Strange thing though, it is as big as grayscale image (it should be smaller, because now each pixel takes only 1 bit) -- for comparison Gimp is way more efficient. I will look further into those options.
Thanks again!
PS. I used this link:
http://www.imagemagick.org/Usage/formats/#png_write
And testes such options:
-type bilevel -define png:color-type=3 -define png:bit-depth=1
In theory it should work, but instead I get error:
convert: Cannot write image with defined PNG:bit-depth or PNG:color-type.
IM in regard to PNG is broken now indeed.
Strange thing though, it is as big as grayscale image (it should be smaller, because now each pixel takes only 1 bit) -- for comparison Gimp is way more efficient. I will look further into those options.
Thanks again!
PS. I used this link:
http://www.imagemagick.org/Usage/formats/#png_write
And testes such options:
-type bilevel -define png:color-type=3 -define png:bit-depth=1
In theory it should work, but instead I get error:
convert: Cannot write image with defined PNG:bit-depth or PNG:color-type.
IM in regard to PNG is broken now indeed.