Reading a Byte Array

Hello,

I have a Byte Array of an image.

How can I load it into Aspose so I can change its Gamma?

Thank you.

Hi Jimmie,


Thank you for considering Aspose APIs, and welcome to Aspose.Imaging support forum.

Please check the following piece of code that reads the image from an array of bytes and performs the Gamma correction to save the results on the disk.

Please give the code a try on your side. In case you face any difficulty or have more questions, please feel free to contact us back.

C#

byte[] bytes = System.IO.File.ReadAllBytes(sourceFilePath);
using (MemoryStream stream = new MemoryStream(bytes))
{
using (RasterImage image = (RasterImage)Image.Load(stream))
{
image.AdjustGamma(0.5f);
image.Save(destinationFilePath);
}

}