SOLVED: Understanding an fx operator?
Posted: 2009-05-10T19:40:35-07:00
I have a convert command with a special effects image operator:
On a high level, I understand what this command is accomplishing: it takes the colors from a gradient image (gradient.png) and applies them as the color palette of the input image (input.png), writing to an output image (output.png).
From what I've figured out, u is the input image, v is the gradient, and it is going through each left-most pixel in the gradient from top to bottom, somehow applying its colors to the input image. But I can't wrap my head around how it's accomplishing that last part, or how to do the same thing in a procedural manner.
I have a piece of software using this command that I'd like to replicate with other image manipulation libraries (to also support anyone in an environment without ImageMagick bindings available). So my question is, can anyone break down exactly what this fx operator is doing in some kind of psuedocode?
Update: Wow, thanks. That pretty much explains it to a tee!
Code: Select all
convert input.png gradient.png -fx "v.p{0,u*v.h}" output.png
From what I've figured out, u is the input image, v is the gradient, and it is going through each left-most pixel in the gradient from top to bottom, somehow applying its colors to the input image. But I can't wrap my head around how it's accomplishing that last part, or how to do the same thing in a procedural manner.
I have a piece of software using this command that I'd like to replicate with other image manipulation libraries (to also support anyone in an environment without ImageMagick bindings available). So my question is, can anyone break down exactly what this fx operator is doing in some kind of psuedocode?
Update: Wow, thanks. That pretty much explains it to a tee!