PDA

View Full Version : QImage



hazardpeter
30th July 2009, 17:35
Hello, I am having a problem regarding QImage and general manipulation of images.

What I need is to load an image and show it on the screen in a window. However I need to do something like load an 100 per 100 pixels image and display only 30 per 30 pixels(or some other value) Without changing the aspect ratio, also display not only the firth 30 per 30 pixels of the image but rather some other location of the image like in the "coordenates" 10 to 40 per 20 to 50 pixels and not of 0 to 30 per 0 to 30.

I have tried looking in Qt Assistant, but it got me really confused and didn't find an answer for my question. Can some one help me on this?

hazardpeter..

numbat
31st July 2009, 10:53
You can get a subset of an image using QImage::copy. When you have the appropriate image you can use the static function QPixmap::fromImage to convert it to a pixmap. Finally, you can set the image for a label using QLabel::setPixmap.

hazardpeter
31st July 2009, 15:19
You can get a subset of an image using QImage::copy. When you have the appropriate image you can use the static function QPixmap::fromImage to convert it to a pixmap. Finally, you can set the image for a label using QLabel::setPixmap.

Thank you very must, QImage::copy() was the method I was looking for!!