Qt reads a lot of image optimizations - how to read the size?

The title sums it up. If I upload ~ 200 images of different sizes. How can I upload only the title so that I can know the size of each image?

Currently, I find that it takes a lot of CPU / memory and I / O to load all of them into memory just for size (I'm trying to create an atlas from them).

QImageThere seems to be no way to do this. QImageReaderit sounded like it was what I wanted, but it still seems to just go ahead and read the whole image, so I'm not quite sure what its purpose is. Is there any other class, or some way to use any of the class that I mentioned just to capture the size of the image from the header?

+4
source share
1 answer

How can I upload only the title so that I can know the size of each image?

It seems like you assumed that the header of the image file (the first few bytes) contains the size of the image. This fails (at least not for all types of image format). I checked it for several formats (PNG).

Currently, I find that it takes a lot of CPU / memory and I / O to load them all into memory just for size

, ~ 200 , . , . , , . , , ~ 200 , , .

QImage, , ?

, , / . , , , , . , ( ).

+3

Source: https://habr.com/ru/post/1534338/


All Articles