Converting from grayscale to RGB colorspaces?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony » 2006-07-30T18:43:52-07:00

Im is probably trying to be 'smart' and knows that the image contains only grey colors, so sames only to a grey TIF format.

It does that sort of output optimization.

You could try making some pixel slightly off-grey by the tinyest amount :-)
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/

User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony » 2006-07-31T16:56:56-07:00

There may be, but I don't know enough of internals to know.

There are a lot of little -define options that you can apply to control the output API handlers, but these are all specific to each format, and the API library they are using.
For example

Code: Select all

-define tiff:rows-per-strip=8
controls the amount of striping in a output TIFF file. These however don't seem to be documented outside the IM source however (if they exist yet).
I have saved all the ones I do know about in IM Examples, Commn File Formats, Miscelenious Notes, but unless it is mentioned on the net I won't know about it.

You may like to mail christy for some more info -- and please share anything you find so I can record it.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/

User avatar
magick
Site Admin
Posts: 11074
Joined: 2003-05-31T11:32:55-07:00

Post by magick » 2006-07-31T17:25:36-07:00

To force a grayscale image to RGB use this command:
  • convert IMG-01-bw.tif -depth 8 -type TrueColor IMG-01-RGB.tif
If the command fails, install a more recent version of ImageMagick.

User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony » 2006-07-31T18:01:04-07:00

I thought -type was a setting for image creation (reading), didn't know it is also an output setting, or is this the case only with TIFF files?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/

User avatar
magick
Site Admin
Posts: 11074
Joined: 2003-05-31T11:32:55-07:00

Post by magick » 2006-07-31T18:22:41-07:00

The -type option is an image operator. In most cases if you find an option handled in MogrifyImage(), its a image operator. If you find it in MogrifyImageInfo(), its an image setting. Finally, if you find it in MogrifyImageList(), it is an image list operator.

User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony » 2006-07-31T19:16:22-07:00

Then how does -type differ from -colorspace
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/

User avatar
magick
Site Admin
Posts: 11074
Joined: 2003-05-31T11:32:55-07:00

Post by magick » 2006-07-31T19:41:54-07:00

The -colorspace and -type option can end up producing the same image but there are differences. For example you can set the grayscale colorspace but you need -type bilevel to produce a monochrome image.

User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony » 2006-07-31T20:37:21-07:00

Okay so if these are the basically the same, is their some reason the two options can't be merged into a single operator with approparite aliasing for backward compatibility?

EG: why two seperate operators?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/

User avatar
magick
Site Admin
Posts: 11074
Joined: 2003-05-31T11:32:55-07:00

Post by magick » 2006-07-31T22:03:51-07:00

There are two separate option because setting the colorspace only sets the image colorspace, whereas, the image type can set one or more of the image colorspace, depth, matte channel, or image colormap.

User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony » 2006-07-31T23:15:29-07:00

Okay thanks.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/

Post Reply