Gwenview open large image failed

I merge several images using the ImageMagick tool, resulting in a large image. However, when I try to open it with Gwenview, it displays “Loading image failed.” I successfully open the image after resizing it to 50%. Is there a way to view it in its original resolution?

Here is the image information:

PS: I can open the original image using sxiv and imv.

I am running with
kernel: 6.8.1-arch1-1
KDE: 6.0.2 (Wayland)
Gwenview: 24.02.0
Qt: 6.6.2

i have the same issue. try starting gwenview from the terminal. for some reason that i havent figured out yet it works when started from the terminal

Regular launching, uses systemd to put the process in a cgroup, that might be a factor. A 47.2 MB jpeg is a lot bigger in-memory.

You can set export QT_LOGGING_RULES="*.debug=true" (this will be VERY verbose) and sudo journalctl -f to see live system logs, then open this file in gwenview.

You can read it about this:
https://blog.davidedmundson.co.uk/blog/modern-process-management-on-the-desktop/

systemd-cgls will allow to list the cgroup state.

i ran the output into a log file. how can i upload the logfile here?

if i try to post the content here i get error 500 and a non functioning website …

found this

Mar 22 19:17:07 solputer2 gwenview[9132]: qt.gui.imageio: QImageIOHandler: Rejecting image as it exceeds the current allocation limit of 256 megabytes

dont know what to do about it

I run sudo journalctl -f and open image in gwenview. Here is the logs:

Mar 24 20:56:16 arch systemd[1150]: Started Gwenview - KDE Image Viewer.
Mar 24 20:56:16 arch gwenview[158842]: kf.i18n.kuit: "Unknown subcue ':whatsthis,' in UI marker in context {@info:whatsthis, %1 the action's text}."
Mar 24 20:56:16 arch gwenview[158842]: org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-mng"
Mar 24 20:56:16 arch gwenview[158842]: org.kde.kdegraphics.gwenview.lib: Unresolved raw mime type  "image/x-samsung-srw"
Mar 24 20:56:16 arch gwenview[158842]: qt.gui.imageio: QImageIOHandler: Rejecting image as it exceeds the current allocation limit of 256 megabytes
Mar 24 20:56:16 arch gwenview[158842]: qt.gui.imageio: QImageIOHandler: Rejecting image as it exceeds the current allocation limit of 256 megabytes

Here is the output when I run systemd-cgls after opening image with gwenview:

─app-org.kde.gwenview-42ee56e4e98b4978b0968dd31d24e83e.scope
 ├─163113 /usr/bin/gwenview /home/tlss/Pictures/zdb/S02EP01-fanart.jpg
 └─163133 /usr/lib/kf6/kioworker /usr/lib/qt6/plugins/kf6/kio/tags.so tags  local:/run/user/1000/gwenviewZBzltD.1.kioworker.socket

When I start gwenview from the terminal, I run systemd-cgls, and it outputs:

─app-kitty-aaa4eca2feb24e448e2f47e32a8092eb.scope
 ├─164479 /usr/bin/kitty
 ├─164490 /usr/bin/fish
 ├─189214 gwenview
 ├─189234 /usr/lib/kf6/kioworker /usr/lib/qt6/plugins/kf6/kio/tags.so tags  local:/run/user/1000/gwenviewvXBSsh.1.kioworker.socket
 └─189244 /usr/lib/kf6/kioworker /usr/lib/qt6/plugins/kf6/kio/thumbnail.so thumbnail  local:/run/user/1000/gwenviewcZUyBP.5.kioworker.socket

Thanks for your reply. My situation seems worse. In my case, it works when started from the terminal for the first few times. And then I close the terminal and double click the image to open it, it failed. And things get weird, I try to start gwenview from the terminal and open the image, it also failed. Then I try to close the terminal and reopen the image from gwenview started from terminal, it worked. After that, I repeated several times, and I found that it seems like 50% can open the image successfully (Like open twice, works once). And now, things get worse, start gwenview from the terminal to open the image is not working, whether I try to reopen the terminal or run the gwenview command. And I do not realize what I am done.

When I open the image from gwenview started in terminal, it always output (whether works or failed):

$ gwenview
kf.i18n.kuit: "Unknown subcue ':whatsthis,' in UI marker in context {@info:whatsthis, %1 the action's text}."
org.kde.kdegraphics.gwenview.lib: Unresolved mime type  "image/x-mng"
org.kde.kdegraphics.gwenview.lib: Unresolved raw mime type  "image/x-samsung-srw"
QPainter::begin: Paint device returned engine == 0, type: 2
QPainter::setOpacity: Painter not active
QPainter::end: Painter not active, aborted
qt.gui.imageio: QImageIOHandler: Rejecting image as it exceeds the current allocation limit of 256 megabytes
qt.gui.imageio: QImageIOHandler: Rejecting image as it exceeds the current allocation limit of 256 megabytes

The problem is that the QImageIOHandler API that Gwenview uses has a built-in limit to how large image it allows the user to open. The default is set to 256MB, and if your image decompresses to be larger than that - the API will prevent it from being opened.

You can control that limit using an API (that as a user you have no access to) or by setting the environment variable QT_IMAGEIO_MAXALLOC.

What you can do is to find the Gwenview entry in the main menu, right click it and select “Edit application…”, then switch to the “Application” tab and in the “Environment Variables” field type: QT_IMAGEIO_MAXALLOC=1500 (or some other large number - don’t go overboard, use as much as you need and not more, the value I specified was enough for me to open images that are 20K pixels wide). Then OK and try to use it.

Oh jeez, we probably need to either disable this in Gwenview, or else improve the error messaging about it.

Worth a bug report.

1 Like

I’m not sure what you want to disable, but this issue seems to be bug 483534: gwenvew doesn’t open high resolution png file [sic].

2 Likes