luberda-molinet / FFImageLoading

Image loading, caching & transforming library for Xamarin and Windows
MIT License
1.42k stars 377 forks source link

Image corruption in UWP apps after applying simple transformation #1430

Open nbevans opened 4 years ago

nbevans commented 4 years ago

I'm on the latest FFImageLoading from nuget.org and on a UWP app I have some code like this:

        ImageService
            .Instance
            .LoadStream(fun _ -> System.Threading.Tasks.Task.FromResult<Stream>(model |> Option.map (fun model -> model.ImageStream) |> Option.defaultValue Stream.Null))
            .Transform(new FFImageLoading.Transformations.CornersTransformation(6., CornerTransformType.AllRounded))

Which produces corrupted output like this:

image

If I remove the .Transform line there - it works okay. I also tried a simple .Transform(new FFImageLoading.Transformations.GrayscaleTransformation()) but this too results in the same corruption.

It seems like there are really bad bugs in the UWP implementation for this?

nbevans commented 4 years ago

The JPG image that can cause this behaviour is here: http://byteflagshared.blob.core.windows.net/files/uwp-test-image.jpg

Please note we have seen this behaviour occur with dozens of images - not just this one. The photo above was taken on a standard iPhone 6 device and no alterations have been made to it.

nbevans commented 4 years ago

I also found this which seems similar:

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/bc4fd6ae-54cf-433c-9a61-7bf999dd64a1/uwp-getting-corrupt-image-when-converting-to-greyscale?forum=wpdevelop

nbevans commented 4 years ago

And this: https://github.com/luberda-molinet/FFImageLoading/issues/1155