How to set the same value to the color channels

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
darkxiv
Posts: 2
Joined: 2015-04-07T02:37:28-07:00
Authentication code: 6789

How to set the same value to the color channels

Post by darkxiv »

Hello! Can someone help me, please? I try to set R channel to B and G channels in my PNG image. It woks good if I change only one channel, but if I change both - all channels get modified (it seems they raised to the power 2.2). How to exclude such behavior?

I try to use:

Code: Select all

sudo convert input.png -channel GB -fx 'R' output.png

Code: Select all

sudo convert input.png -channel RGB -fx 'R' output.png

Code: Select all

sudo convert input.png -channel G -fx 'R' output-step1.png
sudo convert output-step1.png -channel B -fx 'R' output-step2.png
All these commands (and the chain of commands) generate the same png with modified color.
Commands like '-negate' and '-separate' also raising color to the power 2.2.

For example, the next line works fine:

Code: Select all

sudo convert input.png -channel G -fx 'R' output-step1.png
It produce the PNG file with the same R and G channels and do not raised to the power 2.2.

How to get G and B channels equal to the R channel without raising to the power? (or without raising all image to the power 1/2.2).
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to set the same value to the color channels

Post by snibgo »

I suspect you are running an old version of IM. If it is older than 6.8.5, I suggest you upgrade.
snibgo's IM pages: im.snibgo.com
darkxiv
Posts: 2
Joined: 2015-04-07T02:37:28-07:00
Authentication code: 6789

Re: How to set the same value to the color channels

Post by darkxiv »

Oh, it helped. Thank you so much!
Post Reply