The Formulas Rendering Plug-In for the GIMP 2 version 0.9.7
Released on 29-July-2006 at 20:00
Written by Nicolas BENOIT, nbenoit@tuxfamily.org
http://nbenoit.tuxfamily.org

French translation: Nicolas BENOIT
German translation: Dominik SEICHTER


This simple plugin allows you to change the values of each color channel of each pixel of a layer by using mathematical expressions.
It is compatible with RGB* and Gray* layers.

Operator Description
+ addition
- substraction
* multiplication
/ division
^ power
% modulo

 
Function Description Number of arguments
rand ( ) random value between 0.0 and 1.0 no argument
sin ( arg ) sine function one argument
sinh ( arg ) hyperbolic sine function one argument
asin ( arg ) arc sine function one argument
asinh( arg ) arc hyperbolic sine function one argument
cos ( arg ) cosine function one argument
cosh ( arg ) hyperbolic cosine function one argument
acos ( arg ) arc cosine function one argument
acosh ( arg ) arc hyperbolic cosine function one argument
tan ( arg ) tangent function one argument
tanh ( arg ) hyperbolic tangent function one argument
atan ( arg ) arc tangent function one argument
atan2 ( arg1, arg2 ) arc tangent function returning the correct quadrant two arguments
atanh ( arg ) arc hyperbolic tangent function one argument
rad ( arg ) to radians conversion one argument
deg ( sqrt ) to degrees conversion one argument
sqrt ( arg ) square root function one argument
cbrt ( arg ) cube root function one argument
log ( arg ) natural logarithmic function one argument
log2 ( arg ) base-2 logarithmic function one argument
log10 ( arg ) base-10 logarithmic function one argument
exp ( arg ) base-e exponential function one argument
abs ( arg ) absolute value one argument
sign ( arg ) sign of the value one argument
ceil ( arg ) smallest integral value not less than argument one argument
round ( arg ) round to nearest integer, away from zero one argument
min ( arg1, arg2, ..., argn ) minimal value one or more arguments
max ( arg1, arg2, ..., argn ) maximal value one or more arguments
avg ( arg1, arg2, ..., argn ) average value one or more arguments

 
Value Description
pi pi constant
e e constant
j gold number
w width of the image
h height of the image
x x of the cartesian coordinate of the current pixel
y y of the cartesian coordinate of the current pixel
r r of the polar coordinate of the current pixel
t t of the polar coordinate of the current pixel
red original value of the red channel of the current pixel
gray original value of the gray channel of the current pixel
green original value of the green channel of the current pixel
blue original value of the blue channel of the current pixel
alpha original value of the alpha channel of the current pixel

 

The plugin's dialog

As you can see on the screenshot above, the interface of the plug-in is pretty simple.
You just have to enter the formulas inside the text fields...
Always keep in mind that the result of a formula must be between 0 and 255.


Here are a few examples:

Red Channel Green Channel Blue Channel
1 100 (1+cos(rad(x*2.21*x/(y+1))))*92 (1+sin(rad(x*2.21*x/(y+1))))*127
2 ((1+cos(rad(x+y)))*127)+1 ((1+sin(rad(x+y)))*127)+1 y%255
3 (1+sin(x/(w/pi)))*127 (1+sin(y/(w/pi)))*127 255
4 (sin(r)+1)*127 (sin(r)+1)*64 (sin(r+pi)+1)*127