Donaldcwl / browser-image-compression

Image compression in web browser
MIT License
1.3k stars 160 forks source link

[iOS Safari] White Picture if the file size is over 30 MB #116

Closed Frans-L closed 3 years ago

Frans-L commented 3 years ago

Problem

Uploading pictures over 30 MB will lead to a full white picture with iPhone 12 Safari.

image

Demo

The test PNG image can be downloaded from here. The result can be tested in the demo site.

The issue probably exists in all iOS devices. Safari in macOS works.

Possible Reason

The issue might be related that iOS Safari may not handle properly images/videos over 30 MB. I couldn't find any proper source for this except this release note bullet point:

image

Expected Behaviour

The image should be resized normally. If the problem cannot be fixed because of technical limitations, the function should throw an error.

marthee commented 3 years ago

I'm experiencing the same issue with version 1.0.15. imageCompression seemingly succeeds, but the image result is all black and I see this warning in the browser (iOS Safari):

Canvas area exceeds the maximum limit (width * height > 16777216).

I read this [https://github.com/Donaldcwl/browser-image-compression#caveat] part of the documentation as it should be handled. And if not possible, I agree it should throw an error.

Donaldcwl commented 3 years ago

This issue is fixed in version 1.0.16. Thanks for your contributions.