Results 1 to 4 of 4

Thread: Fast QPixmap rotation in 90° steps

  1. #1
    Join Date
    Jun 2012
    Location
    Austria
    Posts
    9
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Fast QPixmap rotation in 90° steps

    I am building something like an image previewer which loads and displays many jpegs. As usual they may contain EXIF information about orientation. Sure I can use QPixmap::transformed to rotate them but this is not really elegant and fast (conversion to QImage and back, a lot of number crunching in the background).
    I found an old thread on this topic: https://development.qt-project.narki...ges-by-default but this seemed to end without an implementation.
    Performing 90 deg rotations could be done very fast right inside the QPixmap - does Qt provide this, am I just missing something?
    Although not a problem it would also be nice to have the EXIF handling wrapped inside Qt (currently I am using libexif and compiling for linux only). I found some old references on QExifImageHeader but it seems not part of Qt5. Is this maybe hidden in some commercial-only licensing schemes?
    Many thanks!

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    4,481
    Thanks
    252
    Thanked 712 Times in 702 Posts
    Qt products
    Qt5
    Platforms
    Windows Android

    Default Re: Fast QPixmap rotation in 90° steps

    Not sure how you are displaying your images, but can you set a transform on your QPainter instance and let the painting system do the rotation?
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  3. #3
    Join Date
    Jun 2012
    Location
    Austria
    Posts
    9
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Fast QPixmap rotation in 90° steps

    I use QLabel as "container" for images, but painting them directly would also be an option.

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,623
    Thanks
    13
    Thanked 1,592 Times in 1,520 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Fast QPixmap rotation in 90° steps

    You can paint to a QPixmap and then apply it to the label.

Similar Threads

  1. Qwt installation steps for Mac
    By Navi in forum Qt Programming
    Replies: 1
    Last Post: 17th June 2015, 15:41
  2. QPixmap being clipped after rotation
    By stereoMatching in forum Newbie
    Replies: 1
    Last Post: 25th November 2012, 21:38
  3. Fast QPixmap creation
    By DavidY in forum Qt Programming
    Replies: 1
    Last Post: 13th December 2009, 00:03
  4. Replies: 1
    Last Post: 21st August 2008, 07:44
  5. Replies: 5
    Last Post: 9th April 2007, 14:26

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.