Calculate pixel brightness


Choose an image




or drag one here



Give an expression that determines the new brightness (range 0..100) for a Pixel that has in the iginal image a brightness h .

Input:
Hit enter to start calculatuion!


Original Calculated

In this applet all pixels are treated equally. For each one a new brightness is calculated from the old brightness.

Enter an expression, e.g. h+30 and observe the result.
Look for expressions that have the following effects:

  • The image is getting darker
  • Contrast is smaller or stronger
  • The image turns to its negativ

Position dependend calculations:
The variables x,y give the position of a pixel: top-left is (0,0), right bottom (320,320).

More suggestions

  • Explain the effect of 20*floor(h/20).
  • Explain the effect of h/2+x/5+y/5

Hints:

  • Operators: +, -, *, /
  • Functions: sqrt, exp, ln, sin, cos, tan
  • absolute value: abs(...), sign: sgn(..), round: round(...), exponentiation pow(a,b)
  • Results above 100 are treated as 100, negative values are treated as 0.