Page 1 of 1

Silly problem, Filling a SINGLE colour channel with grey

Posted: 2009-07-03T09:33:41-07:00
by Jenkins
Title says it all...

I've read all the IM examples about 50 times over, searched the forums for many different strings with no results.

In Photoshop this is easy, but i don't want to do this for just 1 image, i want to do it with Imagemagick for lots and lots of images.

I have many images, the colorspace is RGBA, the alpha channel is not important at the moment.

The Green channel holds all the information where the Blue and Red channels are pure black.

All i need to do is, fill the Red channel with a grey tone, CMYK 50,50,50,50 to be precise.

I've tried and tried and i cannot get this to work because it looks like the -fill option doesn't support the -channel option which imo is silly.

so far i have this non-working script (and many others)

Code: Select all

@ECHO OFF
SET IMDIR=C:\Program Files\ImageMagick-6.5.3-Q16
SET APP=convert.exe

"%IMDIR%\%APP%" test_n.tga -channel R -fill "cmyk(50,50,50,50)" test_n2.tga

PAUSE
The result is a pure grey image which is NOT acceptible

I feel like an idiot asking for what i would think is such a simple problem, but never the less everything i try fails. :(

Any help is greatly appreciated, cheers

-Jenkins

Re: Silly problem, Filling a SINGLE colour channel with grey

Posted: 2009-07-03T10:00:00-07:00
by fmw42
-fill does not actually do the fill, it just specifies the color you want to use.

I believe what you may want is:

convert input -fill "cmyk(50,50,50,50)" -colorize 100,0,0 output

Re: Silly problem, Filling a SINGLE colour channel with grey

Posted: 2009-07-05T23:37:22-07:00
by anthony
More directly, fill red channel with 50% values.... -channel R -evaluate set 50% +channel

See Evaluate and Function Operators
http://www.imagemagick.org/Usage/transform/#evaluate