TiffImage.AdjustGamma

AdjustGamma(float)

Apply gamma correction to the image, adjusting pixel intensities to achieve desired color balance. Incorporate this method into your image processing workflow to enhance visual quality and improve the accuracy of subsequent analysis or display tasks within your application.

public override void AdjustGamma(float gamma)
ParameterTypeDescription
gammaSingleGamma for red, green and blue channels coefficient

Examples

The following example performs gamma-correction of a TIFF image.

[C#]

string dir = "c:\\temp\\";

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
    Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;

    // Set gamma coefficient for red, green and blue channels.
    tiffImage.AdjustGamma(2.5f);
    tiffImage.Save(dir + "sample.AdjustGamma.png", new Aspose.Imaging.ImageOptions.PngOptions());
}

See Also


AdjustGamma(float, float, float)

Perform gamma correction on the image using individual coefficients for red, green, and blue channels, allowing for fine-tuned adjustments of color balance and contrast. Integrate this method into your image processing pipeline to achieve precise control over color rendering and enhance visual fidelity within your application.

public override void AdjustGamma(float gammaRed, float gammaGreen, float gammaBlue)
ParameterTypeDescription
gammaRedSingleGamma for red channel coefficient
gammaGreenSingleGamma for green channel coefficient
gammaBlueSingleGamma for blue channel coefficient

Examples

The following example performs gamma-correction of a TIFF image applying different coefficients for color components.

[C#]

string dir = "c:\\temp\\";

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.tif"))
{
    Aspose.Imaging.FileFormats.Tiff.TiffImage tiffImage = (Aspose.Imaging.FileFormats.Tiff.TiffImage)image;

    // Set individual gamma coefficients for red, green and blue channels.
    tiffImage.AdjustGamma(1.5f, 2.5f, 3.5f);
    tiffImage.Save(dir + "sample.AdjustGamma.png", new Aspose.Imaging.ImageOptions.PngOptions());
}

See Also