Bug 507594 - Fails to work on/save large, high resolution images
Summary: Fails to work on/save large, high resolution images
Status: REPORTED
Alias: None
Product: Skanpage
Classification: Applications
Component: general (other bugs)
Version First Reported In: 25.04.3
Platform: NixOS Linux
: NOR normal
Target Milestone: ---
Assignee: Alexander Stippich
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-07-28 14:36 UTC by Sami Liedes
Modified: 2025-07-28 14:36 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sami Liedes 2025-07-28 14:36:54 UTC
SUMMARY

When scanning at a high resolution / large area—based on reading Qt documentation, I believe the default threshold is the resulting image having more than 500 million pixels, or about 22360x22360 (2000 megabytes at 32 bits per pixel)—skanpage a) fails to show the image in the "Page n" view; b) fails to save. The immediate symptom when scanning is this being printed 2-3 times on stderr:

`qt.gui.imageio: QImageIOHandler: Rejecting image as it exceeds the current allocation limit of 2000 megabytes`

Apparently this limit can be affected by two ways:

- The environment variable QT_IMAGEIO_MAXALLOC, which takes a limit in megabytes (e.g. `QT_IMAGEIO_MAXALLOC=20000`)
- Calling the static method `QImageReader::setAllocationLimit(int)`.

I didn't try the first method yet, since I actually needed to be able to be able to scan the same area I had selected, so I attached gdb to skanpage and did `call QImageReader::setAllocationLimit(10000)`. I can confirm that this fixes the problem for me, bumping the limit higher.

I would suggest that, since this limit is accessible to skanpage, it should either adjust it (possibly asking if the user is sure), or at least fail to even start a scan which will cause this issue.

STEPS TO REPRODUCE
1. Scan an image that has more than 500M pixels
2. Try to save the image

OBSERVED RESULT

1. The image is not shown (but skanpage does not crash)
2. Saving the image fails

EXPECTED RESULT

1. (Optionally) skanpage warns that the image will be large
2. Scanning and saving the image works just as with smaller images (assuming enough RAM)

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: NixOS unstable, using sway as window manager
KDE Plasma Version: 
KDE Frameworks Version: 6.16.0
Qt Version: 6.9.§