Scripts/Color Adjust

From J Wiki
Jump to: navigation, search

Template:Tick

Coloradj.png

Color Adjust is an application that applies color adjustments on an image. The adjustment is the result of applying a linear-power transformation with coefficients: brightness B (-100..100), contrast C (0.2..5) and gamma G (0.2..5), to each pixel channel x (0..255) of the original image:

 $ f(x) = \,_0^{255}]\, B + C\, \hat x^{1/G}, \quad \,_a^b] x=max\{a,min\{b,\lfloor x \rfloor\}\}, \quad f(\hat x) = 255 \,f(x/_{255}) $

The adjustment can be applied to separate or common RGB channels. The color curve plot shows the filter profile which maps the horizontal x input into vertical y.

The histogram shows input levels of the common RGB channel in the original image.

The image is loaded from a file using Addons/media/platimg. The result can be obtained as render verb of the application locale with 0 for separate and 3 for common RGB channels.

  a=. adjimg jpath'~system/examples/data/toucan.bmp'
     NB. ... make adjustments, but don't close the window ...
  (render__a 3) writeimg jpath'~temp/test.png'
  viewrgb readimg  jpath'~temp/test.png'

See Also


Contributed by Oleg Kobchenko