Basic Photo Post Processor Pixel Manipulator

By: Jack Giffin

Overview: This online utility allows you to run a mathematical expression (such as additon, subtraction, multiplication, division, and more) at each and every pixel on an image. The number returned by this mathematical expression is used to create the new pixel at the location on the processed image. Your mathematical expression has access to the pixel that it is at, adjacent pixels, and the x/y coordinates of the pixel.

N.B. The red(x, y), green(x, y), blue(x, y), and thisColor(x, y) functions each measure the color saturation of the specified color at the particular pixel on a scale from 0 (no color) to 255 (max color). If you set a color's saturation to a negative number, then the saturation will be clamped at 0. If you set a color's saturation to greater than 255, then the color saturation will be capped at 255. If you set the color's saturation to a decimal, then the color saturation will be rounded. There is no way around these limitations: your computer screen is not capable of showing color saturation below 0, above 255, or with a decimal.

N.B. You can use any math that you can imagine in mostly intutitive ways. green(x+1, y) can be used to get the greenishness of the pixel to the right. red(x, y+1)*2 can be used to get double the saturation of the red of the above pixel.

N.B. The thisColor(x, y) function changes depending on which box it is used in. It is the same as red(x, y) when used in the newRed function, the same as green(x, y) when used in the newGreen function, the same as blue(x, y) when used in the newBlue function, and the same as alpha(x, y) when used in the newAlpha function. This allows you to more easily copy and paste the same formula into all of the boxes.

N.B. The alpha(x, y) function measures transparency on a scale from 0 (fully transparent) to 255 (not transparent). If every single pixel's alpha is 255 (not transparent), then the alpha transparency function is cross out and blurred out to let you know that you do not have to worry about transparency. PNGs, WEBPs, BMPs, and GIFs may or may not have transparency, but JPEGs never have transparency.

N.B. There is a special ternary operator: condition ? valueIfTrueOrNonZero : valueIfFalseOrZero. The condition operators are > (greater than), >= (greater than or equal to), < (less than), and <= (less than or equal to). Invalid operators are => and =<. These two operators with the equals sign to the left are invalid and cannot be used.

N.B. The stretchFrom(focus, number), stretchFrom(focus, number, power), contractTowards(focus, number), contractTowards(focus, number, power) help you work with the 256 available shades. These 4 functions try to evenly redistribute colors away or towards a certain point.



newRed(x, y, red, thisColor, green, blue, alpha, width, height, stretchFrom, contractTowards) = (
)

newGreen(x, y, red, green, thisColor, blue, alpha, width, height, stretchFrom, contractTowards) = (
)

newBlue(x, y, red, green, blue, thisColor, alpha, width, height, stretchFrom, contractTowards) = (
)

newAlpha(x, y, red, green, blue, alpha, thisColor, width, height, stretchFrom, contractTowards) = (
)


Original Photo

Post Processed