[sf-lug] Forcing a greyscape JPEG into RGB colorspace?

Bill Kendrick nbs at sonic.net
Mon Jun 14 13:22:42 PDT 2010

On Mon, Jun 14, 2010 at 12:14:16PM -0700, Mike Higashi wrote:
> Did you try using the 'convert' program from ImageMagick
> with both the:
>   -colorspace rgb

I am using "convert" with "-colorspace rgb", but it tries to be
'helpful' and disregards my request IF the picture is greyscale.
(If the original image was CMYK colorspace and contained some
color pixels, for example, it converts it to RGB as expected.)

> and the:
>   -colors (with # of colors)
> switches?  From what I can tell, using -colorspace requires
> also using -colors for it to work.

I figured this was for quantization (e.g., take a 24bit RGB
image, and pick the 16 most appropriate colors to create a 4big
indexed image (GIF or PNG for example)).

"-colorspace" certainly works WITHOUT the "-colors" option
(since the tool I wrote successfully does JPEG/CMYK => JPEG/RGB

What value(s) do you image I'd need to use, when converting
an 8bit greyscale image to a 24bit RGB image (which just happens
to have all-grey pixels)?  "man convert" doesn't say much :^(

         -colors value        preferred number of colors in the image


Sent from my computer

More information about the sf-lug mailing list