Replacing multiple RGB colors using color-matrix?
Posted: 2016-11-29T02:37:35-07:00
Hello there!
First of all, I would like to say that I have tried searching for this on Google and forums a lot, but I haven't been able to find a solution. I apologize if this topic has already been solved somewhere else.
So, I want to replace pure RGB colors (#ff0000, #00ff00, #0000ff) by 3 other colors (#b748b2, #a03c9b, #db77b7). I'm trying to use the "-color-matrix" command line, but I'm not sure if it's possible and what I have to put to the matrix.
Here is what I tried:
with colorR = #b748b (183, 72, 178), colorG = #a03c9b (160, 60, 155) and colorB = #db77b7 (219, 119, 183)
So my final formula is something like this:
The result is not what I'm expecting, of course, and I'm wondering if someone could explain to me how I can replace those colors.
I'm using ImageMagick 6.9.6-6 Q16 using macOS command line.
Many thanks!
First of all, I would like to say that I have tried searching for this on Google and forums a lot, but I haven't been able to find a solution. I apologize if this topic has already been solved somewhere else.
So, I want to replace pure RGB colors (#ff0000, #00ff00, #0000ff) by 3 other colors (#b748b2, #a03c9b, #db77b7). I'm trying to use the "-color-matrix" command line, but I'm not sure if it's possible and what I have to put to the matrix.
Here is what I tried:
Code: Select all
colorR.r/255 colorR.g/255 colorR.b/255 0 0,
colorG.r/255 colorA.G.g/255 colorG.b/255 0 0,
colorB.r/255 colorB.g/255 colorB.b/255 0 0,
0 0 0 1 0,
0 0 0 0 0
So my final formula is something like this:
Code: Select all
convert in.png -color-matrix "00.282352941 0.717647059 0.301960784 0 0, 0.37254902 0.764705882 0.392156863 0 0, 0.141176471 0.533333333 0.282352941 0 0, 0 0 0 1 0, 0 0 0 0 0" out.png
I'm using ImageMagick 6.9.6-6 Q16 using macOS command line.
Many thanks!