Difference between revisions of "Color and Tonal Adjustments"

From Apache OpenOffice Wiki
Jump to: navigation, search
Line 31: Line 31:
 
tbd formula
 
tbd formula
  
contrast adjustment positive
+
getting the slope for a positive contrast adjustment value
tbd picture
+
[[file:Positive_contrast_adjustment_InOutFunction.png]]
contrast adjustment negative tbd picture
+
 
 +
getting the slope for a negative contrast adjustment value
 +
[[file:Negative_contrast_adjustment_InOutFunction.png]]
 +
 
The value 128 is not affected by this filter. So the resulting function has the term tbd formula
 
The value 128 is not affected by this filter. So the resulting function has the term tbd formula
 
   
 
   

Revision as of 22:02, 24 April 2013

Template:Documentation/DraftPage Template:Documentation/HelpNeeded

This article address advanced users. It describes the internal calculations for color and tonal adjustments filters.

Color and Tonal Adjustments

To adjust colors, brightness and contrast of a pixel image use the settings in the Graphic panel in the properties deck of the sidebar.

GraphicPanel ColorTonalAdjustment.png

These settings are written to the file, but the image itself is not altered. Therefore you can use these filters not only for embedded images but for linked ones as well.

General

The colors are defined in a 8-bit RGB color space. The color of a pixel is a vector with a red component, a green component, and a blue component, each with integer values in the interval [0‥255].

A filter can be described by a function. Input parameter is the original color or the output of another filter. The resulting out put is the rendered color or the input to another filter. You can illustrate the relationship between input color and output color by a function graph in a coordinate system with the input color on the x-axis and the output color on the y-axis.

If no filter is applied, the function graph is a straight line in 45 degree to the x-axis.

ColorAdjustment InOutFunction Without filter.png

Contrast

The contrast is a signed percent value in the interval [−100%‥100%]. A positive value increases the contrast of the rendered image, a negative value decreases the contrast. This filter is applied to all color channels at the same time.

The filter function is linear. Its slope is calculated by

tbd formula

getting the slope for a positive contrast adjustment value Positive contrast adjustment InOutFunction.png

getting the slope for a negative contrast adjustment value Negative contrast adjustment InOutFunction.png

The value 128 is not affected by this filter. So the resulting function has the term tbd formula

Luminance

The luminance is a signed percent value in the interval[−100%‥100%]. A positive value increases the brightness of the rendered image, a negative value decreases the brightness. It is applied to all color channels at the same time. The function graph is simply shifted up or down by tbd formula. luminancenegative tbd picture

Coloradjustment

The color adjustment is similar to the luminance, but has for each color channel a separate value. A positive value increases the intensity of the that color, a negative value decreases it. The color adjustment can be used for a white balance of the rendered image.

Resulting Filter

Color adjustment, contrast, and luminance settings are applied at the same time.

Let blueIn be the blue component of a pixel in the original image, then the bluecomponent of the rendered pixel can be calculated as below. The green and red components are calculated analogous.

tbd formula

The rendered color blueOut is rounded to integer and constrained to the interval [0‥255].

tbd formula

This filter is not applied to an alpha-channel, which might be present.

The adjustments here are applied before changes, which are induced by the gamma value.

Gamma

The gamma filter provides a non-linear filter, which mainly affects the contrast of the mid-tones. It can be used for a manually gamma correction for special output devices or environments. This filter is applied to all color channels at the same time.

The value gamma is a floating point number. It is stored in the file as percent, e.g. the value 2.5 in the UI is stored as 250%. The UI constrains the value to 0.1 ≤ gamma ≤ 10. Internally values outside the interval ]0‥10] are forced to 1.

Let blueIn be the blue component of a pixel in the image after applied filter for colors, luminance and contrast as described above. Then the bluecomponent of the rendered pixel can be calculated as below, the green and red components are calculated analogous.

tbd formulas

Because tbd formula and tbd formula, very dark colors and very bright colors are less affected than mid-tones. Gamma = 0.5 tbd picture Gamma = 1 tbd picture Gamma = 2 tbd picture

This filter is not applied to an alpha-channel, which might be present.

Personal tools