eXeC64/imv

Unable to redner BIG png image

simoneruffini opened this issue · 11 comments

I have a png image of about 163 MB and imv is not able to render it. It just displays a big white backgroung (that is the main color of the image). I can open the image in the browser (firefox), it takes some time but it manages to do that.

Additional info:
-version: v4.2.0
-os: Linux DellXPS 5.11.11-arch1-1 #1 SMP PREEMPT Tue, 30 Mar 2021 14:10:17 +0000 x86_64 GNU/Linux
-wayland

If you need the image I'll try to upload it somehow (my internet connection is very limited in bandwidth)

I tried compressing the image with image magic to a smaller size and to jpg but still same result.
Then I exportied the original (from krita) directly in jpg, now the file size is 92MB. No render even with that size. Then i converted it through imagemagick (magick back1.jpg -strip -interlace Plane -sampling-factor 4:2:0 -quality 50% back.jpg) still no success. Now the image is 11MB.

GbGp commented

I can replicate this, for example:
https://esahubble.org/images/heic2007a/
I can open the "Publication TIFF 10K" version (163 MB, 10000x6871), but not the fullsize version (520 MB, 17043x11710).
No problem when opening with gimp.

I got the same problem with other images. All of them have weird proportions and a lot of pixels, e.g: 24918x9920.

GbGp commented

Reading the source it looks like the picture is rendered directly as an opengl texture. I don't know anything about opengl but obviously there is a maximum size that depends on the gpu.
Not sure what make more sense for this project, but I am guessing that at very least the renderer should be provided with a copy of the input pic with resolution clipped to GL_MAX_TEXTURE_SIZE.

Years ago when I first wrote imv it used multiple power-of-two sized textures to display the image. I don't remember the reasons for switching to a single-power-of-two texture, but I recall it supporting everything I tried at the time on the devices I had to test with.

I suspect drivers are smart enough that if they're failing for certain images, they won't succeed for multiple textures of an equivalent total size being showed simultaneously. Downscaling and only displaying full resolution when zoomed into a smaller area of the image is probably the required solution, but that adds a lot of implementation complexity.

Ok so this means that imv does not support certain resolutions, right? Hence, which resolutions are supported? And does this means that this issue is a #wontfix?

@eXeC64
@simoneruffini
I also have the same problem, but I don't need to have a large image.
P.S. image 4Mb
114320803-05936c00-9b18-11eb-8d97-2fb0bfb95637
.

GbGp commented

@simoneruffini
The maximum picture size hardware/driver dependent, for example on my machine it's 16384x16384.

Similar problem
ArturKovacs/emulsion#99

Didn't have time to look at this in detail, but it looks like they are fixing the same issue by tiling the image in smaller texts.

It's not a wontfix, the rendering just needs to be refactored to use multiple smaller textures when the image is too big for a single. I'm happy to review PRs, I just have very limited time to write code for imv myself currently.