Hello,
I cannot convert a heic image into jpeg image. What I intended to do is to scale the image and save it in a different format.
However when I want to save it via calling image.Save I get this error:
Image export failed
IndexOutOfRangeException: Index was outside the bounds of the array.
In terms of packages I use Aspose.Imaging (version 24.9.0) and Aspose.Imaging.HEIC.Adapter (version 24.9.0).
This is the code I use:
var resultStream = new MemoryStream();
var heicLoadOptions = HEICLoadOptions.Create();
using (var image = (HEICImage)Aspose.Imaging.Image.Load(sourceFileStream, heicLoadOptions))
{
var aspectRatio = (double)image.Width / image.Height;
var newHeight = (int)(size / aspectRatio);
var options = new Aspose.Imaging.ImageOptions.JpegOptions
{
CompressionType = Aspose.Imaging.FileFormats.Jpeg.JpegCompressionMode.Progressive,
VectorRasterizationOptions = new Aspose.Imaging.ImageOptions.VectorRasterizationOptions()
{
PageWidth = size,
PageHeight = newHeight,
SmoothingMode = isHighQuality ? Aspose.Imaging.SmoothingMode.HighQuality : Aspose.Imaging.SmoothingMode.Default,
}
};
image.Save(resultStream, options); // this is where the code breaks
And this is the image I tried to convert:
1165.zip (2.8 MB)
Can you please help me to solve this issue?