Results 1 to 5 of 5

Thread: Cropping an image with qt

  1. #1
    Join Date
    Jul 2013
    Posts
    27
    Thanks
    11
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Cropping an image with qt

    Hello friends, I am loading some images from a folder. What i want to do is check the dimensions of the image, which i am able to do now, and then if the size exceeds my label size i would like to crop the image. But the cropping should be done by user so the person can select the desired area to be cropped and save the image with same name. I thought this code might be common on internet, but i couldnt find any good ones. If anyone can give me a headstart for this that would be really helpful. Thank you for your time.

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

    Default Re: Cropping an image with qt

    Is your problem with cropping itself or with marking the area for cropping?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jul 2013
    Posts
    27
    Thanks
    11
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Cropping an image with qt

    Hello wyosta :- Its with giving a seperate window where the initial image is loaded and the area is marked using mouse. Sorry for the late reply.

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

    Default Re: Cropping an image with qt

    You should know how to open a new window and load the image into it. As for marking the area, reimplement mousePressEvent(), mouseMoveEvent() and mouseRelease() event to let the user mark two points (one using mouse press, the other using mouse move and release) and reimplement paintEvent() to draw the rubber band between those two points. Alternatively use QRubberBand class with those mouse events.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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

    akshaysulakhe (13th August 2013)

  6. #5
    Join Date
    Jul 2013
    Posts
    27
    Thanks
    11
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Cropping an image with qt

    Thanks, that helped to atleast understand what to do.

Similar Threads

  1. Cropping Image From Rotate Rectangle
    By Parvat in forum Qt Programming
    Replies: 0
    Last Post: 24th June 2013, 07:31
  2. Replies: 4
    Last Post: 15th May 2013, 13:58
  3. Replies: 3
    Last Post: 3rd August 2012, 10:35
  4. Cropping an image in qt
    By Johncdy in forum Qt Programming
    Replies: 4
    Last Post: 10th March 2011, 13:08
  5. Replies: 6
    Last Post: 21st September 2009, 10:55

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
  •  
Qt is a trademark of The Qt Company.