Results 1 to 3 of 3

Thread: QImage

  1. #1
    Join Date
    Jul 2009
    Posts
    22
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QImage

    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..
    class newbie: public QWidget { };

  2. #2
    Join Date
    Jul 2009
    Posts
    139
    Thanks
    13
    Thanked 59 Times in 52 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QImage

    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.

  3. The following 2 users say thank you to numbat for this useful post:

    hazardpeter (31st July 2009), ngochinh (23rd November 2009)

  4. #3
    Join Date
    Jul 2009
    Posts
    22
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QImage

    Quote Originally Posted by numbat View Post
    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!!
    class newbie: public QWidget { };

Similar Threads

  1. Replies: 12
    Last Post: 7th September 2011, 16:37
  2. Creating QImage of specified size from qpic
    By suneel1310 in forum Qt Programming
    Replies: 4
    Last Post: 31st March 2009, 10:53
  3. Streaming QImage (QByteArray, QDataStream, QBuffer)
    By knarz in forum Qt Programming
    Replies: 5
    Last Post: 17th January 2009, 22:05
  4. Multiple QPainters on QImage
    By fire in forum Qt Programming
    Replies: 3
    Last Post: 14th August 2008, 13:10
  5. QImage loadFromData not run... XPDF data
    By patrik08 in forum Qt Programming
    Replies: 7
    Last Post: 24th April 2007, 11:51

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.