GifImage.AdjustGamma
Contents
[
Hide
]AdjustGamma(float)
Enhance image quality by applying gamma correction. This method adjusts the color gamma of the image to achieve optimal visual clarity. It modifies the gamma value of each pixel, resulting in improved color rendition and overall image appearance.
public override void AdjustGamma(float gamma)
Parameter | Type | Description |
---|---|---|
gamma | Single | Gamma for red, green and blue channels coefficient |
Examples
The following example performs gamma-correction of a GIF image.
[C#]
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.gif"))
{
Aspose.Imaging.FileFormats.Gif.GifImage gifImage = (Aspose.Imaging.FileFormats.Gif.GifImage)image;
// Set gamma coefficient for red, green and blue channels.
gifImage.AdjustGamma(2.5f);
gifImage.Save(dir + "sample.AdjustGamma.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
See Also
- class GifImage
- namespace Aspose.Imaging.FileFormats.Gif
- assembly Aspose.Imaging
AdjustGamma(float, float, float)
Gamma-correction of an image applies a nonlinear adjustment to the pixel values, enhancing or reducing brightness based on the specified coefficients for the red, green, and blue channels. This method helps to fine-tune the color balance and luminance of the image, improving its overall appearance and visual quality.
public override void AdjustGamma(float gammaRed, float gammaGreen, float gammaBlue)
Parameter | Type | Description |
---|---|---|
gammaRed | Single | Gamma for red channel coefficient |
gammaGreen | Single | Gamma for green channel coefficient |
gammaBlue | Single | Gamma for blue channel coefficient |
Examples
The following example performs gamma-correction of a GIF image applying different coefficients for color components.
[C#]
string dir = "c:\\temp\\";
using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.gif"))
{
Aspose.Imaging.FileFormats.Gif.GifImage gifImage = (Aspose.Imaging.FileFormats.Gif.GifImage)image;
// Set individual gamma coefficients for red, green and blue channels.
gifImage.AdjustGamma(1.5f, 2.5f, 3.5f);
gifImage.Save(dir + "sample.AdjustGamma.png", new Aspose.Imaging.ImageOptions.PngOptions());
}
See Also
- class GifImage
- namespace Aspose.Imaging.FileFormats.Gif
- assembly Aspose.Imaging