Function
This modifies each pixel in the image according to an expression that you supply. ColorX will normally be slower than a dedicated, optimized function like Mult or Add. Use dedicated operators when possible. You can also set up complex rules inside the function (see below).
Synopsis
image ColorX( image, float expression rExpr, float expression gExpr, float expression bExpr, float expression aExpr, float expression zExpr );
Script
image = ColorX( image, rExpr, gExpr, bExpr, aExpr, zExpr);
For multi-line expressions,
image = ColorX( image, {{expr1,expr2,expr3, rExpr}}, {{expr1,expr2,expr3, gExpr}}, bExpr, aExpr, zExpr );
Command Line
shake -colorX "rExpr" "gExpr" "bExpr" etc....
Expressions can use the variables listed below:
The variables r, g, b, a, and z refer to the value of the original channels (red, green, blue, alpha, and Z).
The variables x and y are the coordinates of the pixel.
The variables width and height are the image's width and height.
The variable time is the current frame number (time).
A large number of operators can be represented by an arithmetic expression, like reordering, color correction and gradient generation, or even circle drawing. Note that no spaces are allowed in the expressions, unless you can use quotes for more explicit grouping.
Task | Example:
Each text field can be filled independently in the GUI - these are all command-line examples |
Reordering: | shake bg.iff -colorx b r a g |
Red correction | shake bg.iff -colorx "r*1.2" |
Red and blue correction: | shake bg.iff -colorx "r*1.2" g "b*1.5" |
Same expression for red, green, and blue: |
shake bg.iff -colorx "(r+g+b)/3" -reorder rrr |
X gradient in matte: | shake -colorx r g b "x/width" |
Y gradient in matte: | shake -colorx r g b "y/height" |
Blue spill removal: | shake primatte/woman.iff -colorx r g "b>g?g:b" |
Random noise | shake -colorx rnd(x*y) rnd(2*x*y) rnd(3*x*y) |
Turbulent noise (1 channel) | shake -colorx turbulence2d(x,y,20,20) |
Clip alpha if Z is less than 20 | shake uboat.iff -colorx r g b "z<20" |
Clip alpha if Z is more than 50 | shake uboat.iff -colorx r g b "z>50" |
A smooth alpha gradient from Z units 1 to 70: | shake uboat.iff -colorx r g b "(z-1)/70" |
See Also
WarpX, LayerX,
TimeX, Expressions