Overview(Edit)
The Formulas Rendering Plug-In for the Gimp 2 is a simple plugin that allows you to change the values of each color channel of each pixel of a layer by using mathematical expressions. It is able to handle RGB* and Gray* images. Available operators are: +, -, *, /, , and %. There are many functions available, such as sin, cos, sqrt, abs, min, max. A few constants are provided (pi, e, j), and a lot of pre-defined variables are usable (w for image's width, h for image's height, x and y for cartesian coordinates in the image, etc.).
Last update: 14-Nov-2010
GIMP Formulas Plugin 0.9.8 - Added support for arbitrary pixel accessor: red(x,y), green(x,y), blue(x,y), etc. - Fixed GUI design glitches and preview rendering. - Fixed minor compilation issues and warnings.
Screenshots(Edit)
Edge detection(Edit)

An edge detection formula (Sobel filter) applied to a black G-clef on a white background.
Operators(Edit)
Operator |
Description |
+ |
addition |
- |
substraction |
* |
multiplication |
/ |
division |
^ |
power |
% |
modulo |
Functions(Edit)
Function |
Description |
Number of arguments |
red ( arg1, arg2 ) |
Red channel value at (arg1,arg2) coordinates |
two arguments |
gray ( arg1, arg2 ) |
Gray channel value at (arg1,arg2) coordinates |
two arguments |
green ( arg1, arg2 ) |
Green channel value at (arg1,arg2) coordinates |
two arguments |
blue ( arg1, arg2 ) |
Blue channel value at (arg1,arg2) coordinates |
two arguments |
alpha ( arg1, arg2 ) |
Alpha channel value at (arg1,arg2) coordinates |
two arguments |
rgb ( arg1, arg2 ) |
Currently processed channel value at (arg1,arg2) coordinates |
two 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 |
Examples(Edit)
|
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 |
sqrt((rgb(x+1,y-1)+2*rgb(x+1,y)+rgb(x+1,y+1)-rgb(x-1,y-1)-2*rgb(x-1,y)-rgb(x-1,y+1))^2+((rgb(x-1,y+1)+2*rgb(x,y+1)+rgb(x+1,y+1)-rgb(x-1,y-1)-2*rgb(x-1,y)-rgb(x-1,y+1))^2))*(255/1442.5) |
sqrt((rgb(x+1,y-1)+2*rgb(x+1,y)+rgb(x+1,y+1)-rgb(x-1,y-1)-2*rgb(x-1,y)-rgb(x-1,y+1))^2+((rgb(x-1,y+1)+2*rgb(x,y+1)+rgb(x+1,y+1)-rgb(x-1,y-1)-2*rgb(x-1,y)-rgb(x-1,y+1))^2))*(255/1442.5) |
sqrt((rgb(x+1,y-1)+2*rgb(x+1,y)+rgb(x+1,y+1)-rgb(x-1,y-1)-2*rgb(x-1,y)-rgb(x-1,y+1))^2+((rgb(x-1,y+1)+2*rgb(x,y+1)+rgb(x+1,y+1)-rgb(x-1,y-1)-2*rgb(x-1,y)-rgb(x-1,y+1))^2))*(255/1442.5) |
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 |
|