-
Notifications
You must be signed in to change notification settings - Fork 298
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
Large image causes images to not load #39
Comments
Hi, thanks for the kind words. Are you experiencing this on iOS or Android ? I don't doubt Android will have memory problems with such images, but I don't know how iOS would behave. |
Thanks for the reply! I just re-tried and ensured that debug JS mode is off. Is it because it should wait for all the images to be fetched before displaying the Gallery? Code:
|
This error is displayed when It would be nice to dig more into this to know exactly why this is failing. Maybe preloading your images before displaying the gallery would fix this, but this isn't a solution. If it works that way, it may explain the error with |
It could possibly be happening as Imgur doesn't like having so many requests, if problem persists with a different image host, I'll re-open the issue. Thanks! |
I am too having this same issue in Android with images captured from my One Plus 5 mobile camera. |
Without having looked into this I'll put an idea on the table: On iPhone, when images takes too much memory they are simply not rendered. I think that Gallery loads three images (previous, current, next). This might deplete the memory if each one of the images is very large. I don't work with Android (for now), but I've heard that there is even less available memory on Android. @guptayush Would it be possible for you to verify if Gallery is working if you scale down the images first? |
@msageryd after scaling down images Gallery is working absolutely fine |
It's quite expensive to have three fullres images loaded. I think that the correct solution would be to use lowres-images when swiping between pages. There would then be two lowres and one fullres image loaded at any same time. I don't know how much work that would be to fix though.. |
@msageryd if i am setting windowSize to 1 then also the first image doesn't load. after swipping it loads |
I'm guessing this is a Flatlist issue/misuse. I still think that the right solution would be to use lower res "swipe-images". Even if we get the "windowSize=1" solution to work you'd not be able to see the next image in a nice transition when swiping. Actually, I think the loading of fullres image should be postponed until the user tries to zoom more than the lowres image allows, hence (#38). May I ask what resolution your images has? I'm trying to dial in an image size for floor plan blueprints that can be handled reliably one at a time (i.e. no gallery swiping). For now I'm using 3500x2500 on iPhone 6, 7, 8 and X. I want to use as large images as possible without having to write a scrolling-tiles algorithm. |
Bugs out when I do this on Android:
I'd guess that one at a time should have no issues. |
@msageryd the images resolution I'm trying is 4608*2592 |
Those images seems to be about the same size as the ones I'm handling (the first image is 3840x2160). An iPhone can handle a couple of those loaded at the same time, but it's a bit sketchy since you have to be aware of everything else you do at the same time so you don't deplete the memory. I'd definitely say that those images should be handled one by one. I've also heard that Android is even more memory constrained than iPhone (I don't work with Android). |
4608*2592 is about 12Mpixels. That's about 36MB at 24bit/px. I fall short of understanding why modern multi-GB-memory phones cannot handle this easier. I only have empirical testing to back this up with, but these tests tells me that multiple images at this size is a no-go on any device. |
This is a long shot again (and I don't have time to test right now).
ViewTransformer use |
One more shot.. I suppose you can reproduce the error reliably? I would be great to know the actual error message (is it a timeout?). Could you try to get hold of the message by temporary altering the call to Image.getSize in TransformableImage/index.getImageSize() link as per below (i.e. just add the error param and console log it):
|
This thread has become a bit hard to follow (my fault). I have mixed my answers for two separate issues. Maybe I should clear some up:
(p.s. I'm not a maintainer. Just a user who is very happy that someone made this awesome lib. Trying to contribute..) |
Error: Pool hard cap violation? Hard cap = 201326592 Used size = 163927868 Free size = 0 Request size = 63700992 This is the error thrown |
Great info. Found this: facebook/react-native#10569 Seems to be a problem only on Android.
I haven't read this, but people refer to it from the above thread: https://zeemee.engineering/react-native-on-android-lessons-learned-99fee8f1d390 |
@msageryd largeHeap="true" worked for me |
Great! @Exilz might want to put this solution/workaround in the readme so other Androiders won't have to come all the way this lengthy thread for the solution. |
Although There's something going on with the garbage collection of the system that makes it slower, hence an app starting much slowly. When you're resuming your app it might also restart completely and reload your bundle. It's an easy fix but I'm warning people reading this issue not to use it unless you're pretty much forced to. We should focus on improving memory usage with large images in the gallery, but it's a pretty huge work. 😄 |
@Exilz My fork is somewhat a mess right now (because I'm not a git wiz). I'd like to start over fresh and take a stab on the "load highres image when user starts to zoom" feature. This would help a lot of the memory problems, albeit not the underlaying GC problem, but still.. If you could accept my Rect-fix PR so I can make a new PR out of my dependency bundling fix, I would be on track with your repo and I could make the new zoom-PR from a clean slate. |
@msageryd I'll test it out this afternoon and merge it if it's okay. Thanks a ton for your help. |
Wouldn't the best solution be that when the gallery pops up, you only fetch the current image, the previous image, and the next image, but onSwipe you would load the next ones, if they're not loaded? Isn't this how most galleries are implemented? I guess for now for my massive galleries I can just make it 1 image galleries. 😍 Oh my, it says I'm a contributor, I only updated the README though, so misleading. |
I had an issue with images not appearing randomly , and it shows instead const images = [ |
@psyanite that's how it works in 2.1.4 (see #21) @msageryd @Exilz rendering really high res images really needs some understanding of how they are rendered and when they are store in memory. What gives the best control here would be the resizeMethod prop of the Image component. |
@vbuch Thanks for the in-depth explanation. |
Just wanted to say this repo is AWESOME!
I experienced some issues rendering approximately 10 of these 4K images from https://imgur.com/gallery/8Yxub. For example I would swipe back and forth and images would disappear then re-appear, some pages was completely blank, some pages would say image cannot be loaded.
Could be a memory issue rather than a dimension issue?
Currently I don't need to render 4K images so that's good!
Many Thanks
The text was updated successfully, but these errors were encountered: