Suggestion to improve performance
I observed that Qt image plugins are created two times when viewing single image.
There are two
loadingdocumentimpl.cpp, one in
bool loadMetaInfo() and second in
The first is used to determine image size (
mImageSize = reader.size();) and the second to load image data.
reader.size() only (without reading the image) is expensive operation sometimes. For some image formats it triggers decoding process. Some image formats do not have final image dimensions in header (like HEIF and AVIF), because various transformations (which include aspect, crop, rotate, mirror) are applied after image decoding.
I suggest to share same QImageReader instance in
loadImageData(), it will prevent the same image to be parsed (or decompressed in some cases) two times.