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?
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.
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
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.