Silly problem, Filling a SINGLE colour channel with grey

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
Jenkins

Silly problem, Filling a SINGLE colour channel with grey

Post 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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

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

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

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

Post 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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply