C# Class ImageProcessor.Imaging.Helpers.Adjustments

Provides reusable adjustment methods to apply to images.
Datei anzeigen Open project: JimBobSquarePants/ImageProcessor Class Usage Examples

Public Methods

Method Description
Alpha ( Image source, int percentage, Rectangle rectangle = null ) : Bitmap

Adjusts the alpha component of the given image.

Brightness ( Image source, int threshold, Rectangle rectangle = null ) : Bitmap

Adjusts the brightness component of the given image.

Contrast ( Image source, int threshold, Rectangle rectangle = null ) : Bitmap

Adjusts the contrast component of the given image.

Gamma ( Image source, float value ) : Bitmap

Adjust the gamma (intensity of the light) component of the given image.

ToLinear ( Image source ) : Bitmap

Converts an image from an sRGB color-space to the equivalent linear color-space.

ToSRGB ( Image source ) : Bitmap

Converts an image from a linear color-space to the equivalent sRGB color-space.

Private Methods

Method Description
GetLinearBytes ( ) : byte[]

Gets an array of bytes representing each possible value of color component converted from sRGB to the linear color space.

GetSRGBBytes ( ) : byte[]

Gets an array of bytes representing each possible value of color component converted from linear to the sRGB color space.

LinearToSRGB ( float signal ) : float

Gets the correct sRGB value from an linear signal.

SRGBToLinear ( float signal ) : float

Gets the correct linear value from an sRGB signal.

Method Details

Alpha() public static method

Adjusts the alpha component of the given image.
/// Thrown if the percentage value falls outside the acceptable range. ///
public static Alpha ( Image source, int percentage, Rectangle rectangle = null ) : Bitmap
source Image /// The source to adjust. ///
percentage int /// The percentage value between 0 and 100 for adjusting the opacity. ///
rectangle System.Drawing.Rectangle The rectangle to define the bounds of the area to adjust the opacity. /// If null then the effect is applied to the entire image.
return System.Drawing.Bitmap

Brightness() public static method

Adjusts the brightness component of the given image.
/// Thrown if the threshold value falls outside the acceptable range. ///
public static Brightness ( Image source, int threshold, Rectangle rectangle = null ) : Bitmap
source Image /// The source to adjust. ///
threshold int /// The threshold value between -100 and 100 for adjusting the brightness. ///
rectangle System.Drawing.Rectangle The rectangle to define the bounds of the area to adjust the brightness. /// If null then the effect is applied to the entire image.
return System.Drawing.Bitmap

Contrast() public static method

Adjusts the contrast component of the given image.
/// Thrown if the threshold value falls outside the acceptable range. ///
public static Contrast ( Image source, int threshold, Rectangle rectangle = null ) : Bitmap
source Image /// The source to adjust. ///
threshold int /// The threshold value between -100 and 100 for adjusting the contrast. ///
rectangle System.Drawing.Rectangle The rectangle to define the bounds of the area to adjust the contrast. /// If null then the effect is applied to the entire image.
return System.Drawing.Bitmap

Gamma() public static method

Adjust the gamma (intensity of the light) component of the given image.
/// Thrown if the value falls outside the acceptable range. ///
public static Gamma ( Image source, float value ) : Bitmap
source Image /// The source to adjust. ///
value float /// The value to adjust the gamma by (typically between .2 and 5). ///
return System.Drawing.Bitmap

ToLinear() public static method

Converts an image from an sRGB color-space to the equivalent linear color-space.
public static ToLinear ( Image source ) : Bitmap
source Image /// The source to convert. ///
return System.Drawing.Bitmap

ToSRGB() public static method

Converts an image from a linear color-space to the equivalent sRGB color-space.
public static ToSRGB ( Image source ) : Bitmap
source Image /// The source to convert. ///
return System.Drawing.Bitmap