I am getting image file with QFileDialog. Image can be in different standard image file extensions. How can I get image size (width and height)?
If you only need the size of the image, but not the image itself, it is better to use the QImageReader. As described in the wiki, not all image data is loaded. This procedure should be much faster:
QImageReader reader("image.png");
QSize sizeOfImage = reader.size();
int height = sizeOfImage.height();
int width = sizeOfImage.width();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With