Results 1 to 4 of 4

Thread: QImage rotate for tiff images

  1. #1
    Join Date
    Jun 2008
    Posts
    14
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default QImage rotate for tiff images

    I used the following code to rotate and flip. I find huge data loss in .tiff and .jpeg images of larger size.

    Is there any approach in QT or any other external QT/ C++ library to over come the issue.


    ////////rotate/////////
    Qt Code:
    1. QImage myImage(currentFile);
    2. QTransform myTransform;
    3. myTransform.rotate(90);
    4. myImage = myImage.transformed(myTransform);
    5.  
    6. bool ret = myImage.save(currentFile);
    To copy to clipboard, switch view to plain text mode 
    ////////////////flip////////////
    Qt Code:
    1. QImage myImage(currentFile);
    2. myImage = myImage.mirrored();
    3. bool ret = myImage.save(currentFile);
    To copy to clipboard, switch view to plain text mode 

    thank you
    Last edited by wysota; 16th June 2011 at 11:51. Reason: missing [code] tags

  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: QImage rotate for tiff images

    What kind of "loss" are you talking about? TIFF is a lossless format, it shouldn't lose any information from the image.
    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
    Jun 2008
    Posts
    14
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QImage rotate for tiff images

    1) The file size reduces for jpeg and increases for tiff image files. The file size of 3.27 jpeg image becomes, 1.1Mb and the file size of 35Mb of tiff becomes 47.2Mb.
    2) If the program performanes, do (rotate) and undo of same file repeatedly, the original file is not restored.

    Thank you

  4. #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: QImage rotate for tiff images

    Quote Originally Posted by jessiemmichael View Post
    1) The file size reduces for jpeg and increases for tiff image files. The file size of 3.27 jpeg image becomes, 1.1Mb and the file size of 35Mb of tiff becomes 47.2Mb.
    2) If the program performanes, do (rotate) and undo of same file repeatedly, the original file is not restored.
    Both of these are perfectly normal since both file formats use compression
    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:

    jessiemmichael (20th June 2011)

Similar Threads

  1. Loading corrupt jpeg images with QImage
    By mikeee7 in forum Qt Programming
    Replies: 15
    Last Post: 3rd December 2010, 01:59
  2. Pass remote (web) images to QImage
    By NicholasSmith in forum Qt Programming
    Replies: 2
    Last Post: 25th August 2009, 22:00
  3. Replies: 4
    Last Post: 27th July 2009, 15:45
  4. Writing Images using QImage from 2D Array
    By kaydknight in forum Qt Programming
    Replies: 1
    Last Post: 29th December 2007, 03:06
  5. Tiff in unsigned short
    By spawnwj in forum Qt Programming
    Replies: 14
    Last Post: 26th July 2006, 07:41

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.