View Full Version : join images together without merging
19th February 2011, 02:17
I want to know how to join 4 images together without overlapping one above the other in Qt 4.7. Consider i have image1.png(200x200), image2.png(200x200), image3.png(200x200),image4.png(200x200) where 200x200 is the dimension of the image.now these 4 images should be join in such a manner they look distinct and there should not be overlapping,overlayering or no stacking of images.so that 4 images should behaves as single image,and later if i add any zoom effect it should scaled accordingly.
19th February 2011, 08:17
For four images source1, ... source4 of size WxH create an image target of size 2*W x 2*H, setup QPainter on the target and paint the source images to four corners of target using one of the QPainter::drawImage (http://doc.qt.nokia.com/latest/qpainter.html#drawImage) method.
4 images should behaves as single image,and later if i add any zoom effect it should scaled accordingly
If you want the merged image later to be passed to other methods that accepts a QImage, it must be one QImage. I don't think I understand what you mean in this sentence.
20th February 2011, 08:49
Currently i have used QFrame which is inside MainWindow.i have to use 4 images of equal size within this frame.lets consider my frame size is 500x500,these 4 images should be joined or stitched in such a manner,so that they should not overlap one above the other.Moreover,they should behave as one single image.so if in later stage i want to add zoom effect those 4 images also get zoomed like a normal image.But can u suggest me suppose we create
now how we can pass the pixmap to a label that we have created through QPainter. bcoz we cant pass painter object to QLabel,if u have any idea please let me know
20th February 2011, 10:23
Don't worry about the frame size, first join the images and then you can resize the merged image to whatever size you need.
But can u suggest me suppose we create
now how we can pass the pixmap to a label that we have created through QPainter
Read the QPainter docs (http://doc.qt.nokia.com/latest/qpainter.html#details), there is an example how to use it:
QPixmap mergedImg( width, height );
//... do the painting
// and then assign mergedImg for label
Powered by vBulletin® Version 4.1.9 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.