Results 1 to 4 of 4

Thread: Clip/crop/cut an image

  1. #1
    Join Date
    Sep 2008
    Posts
    17
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Clip/crop/cut an image

    Hi everyone!

    I'm just a newbie by using image with Qt, and I have some questions.
    (I didn't find the answers anywhere. Maybe here..)

    So, can I manipulate an image (like .png) inside my Qt program? I don't think about composition. My goal is to clip an image, but I don't know exactly, what tool I should use. Maybe QPainter or QImage or QPicture?
    What tool does support to clip an image, and save the result in an other image?
    (Image: no just lines -- it is not vector-graphical, it is pixel-graphical, like a pic of butterfly..)

    I think the solution is easy, just I am not prudent enough.
    Thank you for your answers.

    Bye,
    greenvirag
    Last edited by greenvirag; 15th November 2008 at 11:44. Reason: Specifies problem

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Clip an image

    Use QImage. There is QImage::copy() you can use.

  3. The following user says thank you to wysota for this useful post:

    greenvirag (15th November 2008)

  4. #3
    Join Date
    Sep 2008
    Posts
    17
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Clip/crop/cut an image

    Thank you, it works, ans it was really easy

    So, but some questions: what is the difference between paint devices? just the goal what they will modify (e.g. pixmap, widget, image, etc)? But what about the QPicture?When is it useful?

    And one more question. What is the connection between QImage, QImageWriter and QImageReader. If I have a QImage, how will it be used by QImageWriter? As I saw, there isn't any constructors for QImageWriter with QImage?

    Thank you for your patience.

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Clip/crop/cut an image

    QPicture can be thought of as a "macro recorder" - you record a series of painting operations and then you can replay them on another device. Just like a display list in OpenGL.

    QImage is a storage class for image data that is read using QImageReader and written using QImageWriter. When you construct a QImage from file, it uses QImageReader to populate itself with data. It's because you have many file formats and QImage couldn't handle them all by itself. Thanks to the image reader, we can use plugins to extend Qt with capabilities of handling alien image formats (like medical data, for instance).

Similar Threads

  1. can Qlabel display a series of image one by one ?
    By jirach_gag in forum Qt Tools
    Replies: 3
    Last Post: 11th August 2008, 15:36
  2. Finding marks on scanned image for alignment
    By caduel in forum Qt Programming
    Replies: 1
    Last Post: 23rd September 2007, 02:10
  3. Explanation to Image Formats
    By sincnarf in forum Qt Programming
    Replies: 13
    Last Post: 6th July 2007, 17:02
  4. How and when to repaint a widget ?
    By yellowmat in forum Newbie
    Replies: 7
    Last Post: 3rd April 2006, 16:36
  5. Question about updating an image on screen
    By SkripT in forum Qt Programming
    Replies: 1
    Last Post: 24th February 2006, 19:01

Tags for this Thread

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.