Page 1 of 1

Re: Is it a bug when convert *.bmp -colorspace Gray *.bmp ?

Posted: 2008-01-26T16:03:14-07:00
by fmw42
I believe that all images created or converted within IM will actually have 3 channels, even if they are all the same grayscale channel. Thus the filesize will not change as you still have 3 channels and not one channel.

The commands

convert <inflle> -colorspace Gray <outfile>

and

convert <infile> -type Grayscale <outfile>

will still create a 3-channel image, but all 3 channels will be the same grayscale image.

I don't know of any way to save a single channel image within IM. If you import a single channel image into IM, as soon as you process it, it will become 3 channels.

Someone else may be able to correct me on this, if I am wrong.

Re: Is it a bug when convert *.bmp -colorspace Gray *.bmp ?

Posted: 2008-01-30T18:04:28-07:00
by anthony
If the image file format, and the IM format 'coder' module can handle a gray image. then the -type GrayScale should save the image with a single gray channel.

-colorspace is the in memory representation. With IM this basically makes each RGB channels all the same to 'kludge' a gray image, while allowing most operators to treat it as a simple 3 channel RGB image. Make sthe programming easier.

-type will first ensure the image is greyscale (just before saving, or when reading in an image) and then ask the coder module to save it as grayscale if it can. It is the file 'type' format of the image.

See IM Examples...
http://imagemagick.org/Usage/basics/#colorspace
http://imagemagick.org/Usage/basics/#type