Error on load AVIF

Hello Support,

loading the attached AVIF files with Imaging cause following exception:

Aspose.Imaging.CoreExceptions.ImageLoadException : Image loading failed.
  ----> System.DataMisalignedException : A datatype misalignment was detected in a load or store instruction. 
Stack Trace: 
Image.#=zWeP8M$UDYG$s(StreamContainer #=zoeg6qVGnd3et, LoadOptions #=zqNDs2RXz0Rro, #=z33qUV_S8oppDrUBEKbmxoI0e4KPJJGxnOJmyxKs= #=zCIKql0Q=)
Image.Load(String filePath)

AVIF_ErrorOnLoad.zip (1.0 MB)

the used source code:

using (var image = (AvifImage)Image.Load(inputFileName))
 {
     var exportOptions = new Aspose.Imaging.ImageOptions.JpegOptions();
     // Save image to jpg
     image.Save(outFileName, exportOptions);

     //Save image  to pdf
      var pdfexportOptions = new Aspose.Imaging.ImageOptions.PdfOptions();

     image.Save(outFileNamePdf, pdfexportOptions);
 }

Can you please check and give me a feedback?
Thanks
Vasilis

@VasilisGiannoutsos

Cause

The error you’re encountering when loading AVIF files typically indicates that there may be an issue with the file format or the way the library is handling the specific AVIF file. The System.DataMisalignedException suggests that there might be a problem with data alignment during the loading process.

Solution

To troubleshoot this issue, consider the following steps:

  1. Check File Integrity: Ensure that the AVIF files you are trying to load are not corrupted. Try opening them in a different image viewer to confirm they are valid.

  2. Update Aspose.Imaging: Make sure you are using the latest version of Aspose.Imaging. Updates often include bug fixes and improvements for handling various file formats, including AVIF.

  3. Use LoadOptions: When loading the image, try specifying LoadOptions to see if it helps with the loading process. For example:

    var loadOptions = new Aspose.Imaging.ImageLoadOptions();
    using (var image = (AvifImage)Image.Load(inputFileName, loadOptions))
    {
        // Proceed with your processing
    }
    
  4. Test with Different Files: If possible, test with different AVIF files to see if the issue is specific to certain files or a general problem with AVIF handling.

Code

Here’s a sample code snippet that incorporates the above suggestions:

using Aspose.Imaging;
using Aspose.Imaging.ImageOptions;

try
{
    var loadOptions = new ImageLoadOptions();
    using (var image = (AvifImage)Image.Load("path/to/your/file.avif", loadOptions))
    {
        var exportOptions = new JpegOptions();
        image.Save("output.jpg", exportOptions);
        
        var pdfExportOptions = new PdfOptions();
        image.Save("output.pdf", pdfExportOptions);
    }
}
catch (ImageLoadException ex)
{
    Console.WriteLine($"Error loading image: {ex.Message}");
}

Next Steps

If the problem persists after trying the above steps, please provide additional details about the specific AVIF files you are using, including their source and any specific characteristics (e.g., resolution, color depth). This information can help in diagnosing the issue further.

Please implement these suggestions and let me know the outcome!

The problem is not solved by the suggested troubleshooting
ImageLoadOptions - class does not exist in Aspose.Imaging.ImageOptions
var loadOptions = new ImageLoadOptions();

@VasilisGiannoutsos Thank you for reaching out to us! We appreciate your interest in our product. We will thoroughly investigate this issue and work to provide a solution as quickly as possible. Which version of Aspose.Imaging are you using?

@VasilisGiannoutsos
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-7739

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.