mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2026-06-10 01:59:11 -04:00
Updated documentation on memory usage
This commit is contained in:
12
README.md
12
README.md
@@ -244,7 +244,7 @@ RGB.
|
|||||||
Where possible, plugins support large images. By convention, many of the
|
Where possible, plugins support large images. By convention, many of the
|
||||||
large image plugins are limited to a maximum of 300,000 x 300,000 pixels.
|
large image plugins are limited to a maximum of 300,000 x 300,000 pixels.
|
||||||
Anyway, all plugins are also limited by the
|
Anyway, all plugins are also limited by the
|
||||||
`QImageIOReader::allocationLimit()`.
|
`QImageReader::allocationLimit()`.
|
||||||
|
|
||||||
> [!note]
|
> [!note]
|
||||||
> You can change the maximum limit of 300000 pixels by setting the constant
|
> You can change the maximum limit of 300000 pixels by setting the constant
|
||||||
@@ -300,8 +300,18 @@ consumption proportional to the size of the image to be saved.
|
|||||||
Normally this is not a source of problems because the affected plugins
|
Normally this is not a source of problems because the affected plugins
|
||||||
are limited to maximum images of 2GiB or less.
|
are limited to maximum images of 2GiB or less.
|
||||||
|
|
||||||
|
Note that the value of `QImageReader::allocationLimit()` is only used when
|
||||||
|
allocating a new `QImage`. Since this parameter was created to limit damage
|
||||||
|
caused by corrupted files, any conversion of `QImage` (for example, with
|
||||||
|
`QImage::convertTo()`) is not subject to this limit.
|
||||||
|
|
||||||
On plugins for formats that support large images, progressive conversion has
|
On plugins for formats that support large images, progressive conversion has
|
||||||
been used or the maximum size of the image that can be saved has been limited.
|
been used or the maximum size of the image that can be saved has been limited.
|
||||||
|
Plugins that use external libraries don't always allow progressive decoding
|
||||||
|
(e.g., the JPEG series). In these cases, the memory required for reading
|
||||||
|
may be much larger than the entire decoded image. When the external library has
|
||||||
|
a maximum memory limit function, the value of `QImageReader::allocationLimit()`
|
||||||
|
is set.
|
||||||
|
|
||||||
### Non-RGB formats
|
### Non-RGB formats
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
|
|||||||
int argc = 0;
|
int argc = 0;
|
||||||
QCoreApplication a(argc, nullptr);
|
QCoreApplication a(argc, nullptr);
|
||||||
|
|
||||||
QImageReader::setAllocationLimit(2000);
|
QImageReader::setAllocationLimit(512);
|
||||||
|
|
||||||
QImageIOHandler* handler = new HANDLER();
|
QImageIOHandler* handler = new HANDLER();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user