Results 1 to 4 of 4

Thread: join images together without merging

  1. #1
    Join Date
    Feb 2011
    Location
    Bangalore
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default join images together without merging

    hi friends,
    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.
    Thanks

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: join images together without merging

    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 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.

  3. #3
    Join Date
    Feb 2011
    Location
    Bangalore
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: join images together without merging

    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
    QPainter painter;
    QPixmap pixmap;
    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

  4. #4
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: join images together without merging

    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
    QPainter painter;
    QPixmap pixmap;
    now how we can pass the pixmap to a label that we have created through QPainter
    Read the QPainter docs, there is an example how to use it:
    Qt Code:
    1. QPixmap mergedImg( width, height );
    2. QPainter painter(&mergedImg);
    3. //... do the painting
    4. painter.end();
    5. // and then assign mergedImg for label
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 1
    Last Post: 20th January 2011, 10:26
  2. Merging files (*.001, *.002 etc.)
    By Altertwin in forum Qt Programming
    Replies: 1
    Last Post: 11th July 2010, 11:15
  3. Merging to different QBrushPattern?
    By ashukla in forum Qt Programming
    Replies: 2
    Last Post: 12th January 2008, 04:32
  4. Menubar Merging
    By elcuco in forum Qt Programming
    Replies: 3
    Last Post: 7th April 2007, 15:54

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.