Created attachment 173203 [details] Error shown when loading large file. SUMMARY Opening files >8192x8192 (>67108864 pixels overall) fails after latest update. STEPS TO REPRODUCE 1. Open kolourpaint and goto "Image -> Resize/Scale". 2. Click "Resize" and set height and width to 8193 3. Save and close the file 4. Try to open the file, you will see the error: 'Could not open "{$filename}" - unsupported image format.' The file may be corrupt. OBSERVED RESULT Kolourpaint fails to load the file and renders a blank (white) cavas 2048x2048 pixels on starting. EXPECTED RESULT Kolourpaint loads and displays the file. SOFTWARE/OS VERSIONS OS: Fedora release 40 (Forty) KDE Frameworks Version: 6.5.0 Qt Version: 6.7.2 (built against 6.7.2) ADDITIONAL INFORMATION
Confirmed on kolourpaint built from git master.
Just started from konsole and got this which seems relevant: qt.gui.imageio: QImageIOHandler: Rejecting image as it exceeds the current allocation limit of 256 megabytes
So, seems like a workaround for this is to set the QT_IMAGEIO_MAXALLOC environment variable according to https://doc.qt.io/qt-6/qimagereader.html. Doing: $ export QT_IMAGEIO_MAXALLOC=8192 $ kolourpaint allows me to open large files again (8192MiB may be overkill for my needs currently, but you get the point you can define an arbitrary value). Seems like the fix would be for kolourpaint to set QImageReader::setAllocationLimit(0). Amusingly, the preview that shows up in the File -> Open dialog works regardless of what limit is set, so maybe the above is already done for that.
edit to my last comment: $ export QT_IMAGEIO_MAXALLOC=0 works also, I expect functionally the same as code doing QImageReader::setAllocationLimit(0)
Thanks for the investigative work! Hopefully it should be an easy fix for the developers if the code already exists in the open dialog function!
Git commit 5c6f5b4d10065d136f733d8644be410854c13551 by Martin Koller. Committed on 25/09/2024 at 12:03. Pushed by mkoller into branch 'master'. Unset memory limit for QImageReader M +1 -0 kolourpaint.cpp https://invent.kde.org/graphics/kolourpaint/-/commit/5c6f5b4d10065d136f733d8644be410854c13551