Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] Blank image returned when compress size above certain value #2074

Open
markholland opened this issue Jul 19, 2024 · 1 comment · May be fixed by #2075
Open

[iOS] Blank image returned when compress size above certain value #2074

markholland opened this issue Jul 19, 2024 · 1 comment · May be fixed by #2075

Comments

@markholland
Copy link

markholland commented Jul 19, 2024

Version

Tell us which versions you are using:

  • react-native-image-crop-picker v0.41.2
  • react-native v0.73.9

Platform

Tell us to which platform this issue is related

  • iOS physical device (iPhone 15 Pro tested)

Expected behaviour

Picking an image with options:

{
  compressImageMaxHeight: 2049,
  compressImageMaxWidth: 2049
}

To return the resized image.

Actual behaviour

Returns a blank image

Steps to reproduce

Call ImagePicker.openPicker() with options:

{
  compressImageMaxHeight: 2049,
  compressImageMaxWidth: 2049
}

Select an image with the picker

Open image referenced by result.path. It will be blank instead of resized original image.

Description

We encountered an issue after upgrading to versions >= 0.41.0.

We are setting compressImageMaxHeight and compressImageMaxWidth, the issue is that the resized image would be blank.

We narrowed it down to this commit. On the surface it looked like an important change but definitely was the cause of our issue.

After further debugging we discovered that the issue would only occur for values of compressImageMaxHeight/compressImageMaxWidth >= 2049 on iPhone 15 Pro

At which point we noticed a log in the debugger 8196 by 6147 iosurface is too large for GPU

This lead us to issues such as https://stackoverflow.com/questions/61263161/why-use-a-lot-of-memory-when-drawing-image-with-uigraphicsimagerenderer and https://stackoverflow.com/questions/77150918/how-do-i-prevent-uigraphicsimagerenderer-image-from-crashing-when-using-uiimag

Applying the fix found there resolved the issue for us.

Example app can be found here. Image will be blank unless compress size is reduced.

PR with fix here

@wrldh
Copy link

wrldh commented Oct 10, 2024

I confirm that issue exists. Tested on physical iPhone 14 iOS 17.
Small images are okay, larger ones appear to be blank.
Using library version 0.40.3 it still works okay with the same files. Using v. 0.41.2 images appear to be blank after resizing.

compressImageMaxHeight and compressImageMaxWidth are set to 3000 in my case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants