HEIC Conversion to JPEG, image export failed

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?

@Milijanovic00
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): IMAGINGNET-7460

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Hi @Milijanovic00
This will be fixed in the next version.

Hi @Nikita_Romanov ,

Thank you for the information

Hi @Nikita_Romanov ,

Can you please give me some expected date on which it’ll be finished?

And one more thing, is this fix going to be provided in the new version of Aspose.Imaging or in Aspose.Imaging.HEIC.Adapter?

The reason I ask is that I noticed there is a newer version of Aspose.Imaging which is 24.11.0 and I switched to it but when I tried to convert the heic image I got an error saying something like “This version of Aspose.Imaging.HEIC.Adapter is too old for this new version of Aspose.Imaging”.

@Milijanovic00
I think that will take a week or two and it will be released as a new version of Aspose.Imaging.HEIC.Adapter.

We’ll also check if we can address this problem.

Hi @Nikita_Romanov,

Thank you for the information.

Hello @Milijanovic00 ,

Aspose.Imaging.HEIC.Adapter was updated to 24.11.0 with the fix.
Also we have applied the new dependency strategy for adapters and now you can use newer Aspose.Imaging versions with an older apapter (the version difference cannot be more then 3 months, but there is no more strict version dependecy).

Hello @Nikita_Romanov,

Thank you for providing the fix.

Have a great day :slight_smile: