hey-red / ImageSharp.Heif

HEIF/AVIF decoder for ImageSharp
MIT License
7 stars 3 forks source link

Unable to convert heif to jpg taken by iPhone 15 pro #4

Open AudriusAdroiti opened 3 months ago

AudriusAdroiti commented 3 months ago

When trying to convert heif images (taken with iPhone 15 pro) to jpg format, we get an error Invalid input: Unspecified: Metadata not correctly assigned to image

Code snippet which throw an exception

private static async Task<Stream> EditImageInMemoryAsync(Stream orignalImage, Action<IImageProcessingContext> opereation, IImageFormat format)
        {
            var modifiedImage = new MemoryStream();
            using var image = await Image.LoadAsync(orignalImage);
            image.Mutate(opereation);
            image.Save(modifiedImage, format);
            modifiedImage.Position = 0;
            orignalImage.Position = 0;
            return modifiedImage;
}

Similar issue were fixed in this package.

bad-images.zip - zip file with images. With these images we get an error.