QImage image("example.png"); int bytes = image.numBytes(); qDebug() << "Image size in bytes:" << bytes;
QImage image(100, 100, QImage::Format_RGB32); int bytes = image.numBytes(); qDebug() << "Image size in bytes:" << bytes;In this example, we create a QImage with a specific width and height, and a specific pixel format (RGB32). We then call numBytes to get its size in bytes. The package library for QImage is Qt, specifically the Qt GUI module.