QImage image("image.png"); QRect rect = image.rect();
QImage image("image.png"); QRect rect(10, 10, 100, 100); QImage croppedImage = image.copy(rect);This code creates a QImage object from the image file "image.png" and creates a QRect object representing a rectangular area with coordinates (10, 10) and size (100, 100). Then it uses the copy() method of the QImage class to create a new QImage object with only the specified portion of the image. Package/Library: Qt Framework.