RGB Conversion Not Working?

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
BernardMagic
Posts: 2
Joined: 2011-03-30T06:17:07-07:00
Authentication code: 8675308

RGB Conversion Not Working?

Post by BernardMagic »

ImageMagick 6.6.8-Q8 on Windows 7 Home Premium via CMD Prompt.

I'm running into some trouble while attempting to convert an image from grayscale to RGB.

My command is as follows:

convert A16.TIF -resize 33% -auto-level -colorspace RGB A16.jpg

I've tried the above line with CMYK and it works, however it just doesn't seem to convert to RGB properly. I've been checking the resultant file in Photoshop to see the colorspace.
The reason I need to convert to RGB is to colorize the image with a green or red hue.

Here's an example of what I'm trying to accomplish. . .

Image

I'll be posting a bit later with another question or two if I can get this working. I really appreciate any assistance with this matter.

Thank you!
Bernard
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: RGB Conversion Not Working?

Post by fmw42 »

try

convert A16.TIF -colorspace gray -resize 33% -auto-level +level-colors black,green A16.jpg

see
http://www.imagemagick.org/Usage/color_ ... vel-colors
BernardMagic
Posts: 2
Joined: 2011-03-30T06:17:07-07:00
Authentication code: 8675308

Re: RGB Conversion Not Working?

Post by BernardMagic »

Thanks fmw42!

The script you posted seems to do exactly what I need! I was a bit confused by the colorspace command before, but I think I understand it a bit better now. I really appreciate it!
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: RGB Conversion Not Working?

Post by anthony »

Warning 'Green' is the SVN definition which is a half-bright RGB green. To get true RGB green use 'Lime'

See Color Names
http://www.imagemagick.org/Usage/color_ ... olor_names
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: RGB Conversion Not Working?

Post by fmw42 »

anthony wrote:Warning 'Green' is the SVN definition which is a half-bright RGB green. To get true RGB green use 'Lime'

See Color Names
http://www.imagemagick.org/Usage/color_ ... olor_names
I just used "green" as a quick easy to understand example as I did not know the exact green shade he wanted. However, Anthony is correct. If you want pure green use either green1 or lime.

By the way, colors are not limited to named colors, but you can use hexcolors or rgb colors. See Anthony's example using rgb values and also the IM color page at http://www.imagemagick.org/script/color.php (same as Anthony posted above).
Post Reply