Draw

Adjust

When you click Run, the code in the upper left will be run for each pixel in the image.

W and H refer to the width and height of the image.

X and Y refer to the location of the current pixel.
X goes from 0 to W-1, left to right.
Y goes from 0 to H-1, top to bottom.

R, G, and B refer to the color of the current pixel being drawn.
R is the red value, G is the green value, and B is the blue value.
Each one can go from 0 (none) to 100 (maximum).

getR, getG, and getB are functions that take in an X and Y value, and refer to the color value of the original pixel at that location. For example, getR(10,20) refers to the red value of the pixel at X=10,Y=20 in the original image.

Available math operations:

+   Add
-   Subtract
*   Multiply
/   Divide
%   Remainder (x%y means remainder from x/y)

&&  And
||  Or
!   Not

<   Less than
<=  Less then or equal
>=  Greater than or equal
>   Greater than

Math.sqrt(x)    square root of x
Math.abs(x)     absolute value of x
Math.random()   random number between 0 and 1

For more math functions, click here.