# Documentation

## The Color Factory plug-in

The Color Factory plug-in allows you to modify the values of the R,G,B and Alpha channels of the selected images, thanks to mathematical formulas. (ie : R,G,B and Alpha values of the pixels of your images)

Based on the additive color principle, all colors are mixture of red, green and blue (more or less dark) in exact proportions.
Each color can be broken up in various ways depending on the color system. For example, the Slider tab of the Color Picker panel gives the numerical values of the A color in the R,G,B and H,S,L color systems. Each text field of the Color Factory panel describes one component (R,G,B or Alpha) and can contain a mathematical formula. The new values of those components will be computed using the formulas you have entered (the Alpha component indicates the opacity of the pixels).
The variables that you can use in your formulas are listed in the table below (all in lower case) :

The variables :
rValue of the Red component of the pixel
gValue of the Green component of the pixel
bValue of the Blue component of the pixel
aValue of the Alpha component of the pixel
xx coordinate of the pixel
yy coordinate of the pixel
wWidth of the current project
hHeight of the current project

And here are listed the arithmetic operators :

Arithmetic operatorsExamples :
-substract18 - 6 = 12
*multiply18 * 3 = 54
/divide18 / 3 = 6

It is possible to use parentheses ( ) in order to set priorities in your computations. If you don't use them, the plug-in will evaluate the operations from the left to the right.
For instance : 1+2*3 = 9 1+(2*3) = 7

Here are a few examples using the Color Factory plug-in.
* Let's begin with a classic image without any modification :  * Here is a negative of the previous landscape :  * Below, the red and blue components of the landscape have been inverted : the sky turned into orange and the road turned from red to blue. The green component stay unchanged.  * The Color Factory plug-in can also be used to create nice color gradients. Therefore, the formulas on the right panel below are more complicated.  * Below, simple additions have been done with the red and green color channels inverted.  * Here is the last example : an opacity gradient from the top right to the bottom left of the image.  