PDA

View Full Version : QImage rotate for tiff images



jessiemmichael
16th June 2011, 11:45
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/////////

QImage myImage(currentFile);
QTransform myTransform;
myTransform.rotate(90);
myImage = myImage.transformed(myTransform);

bool ret = myImage.save(currentFile);
////////////////flip////////////

QImage myImage(currentFile);
myImage = myImage.mirrored();
bool ret = myImage.save(currentFile);

thank you

wysota
16th June 2011, 12:50
What kind of "loss" are you talking about? TIFF is a lossless format, it shouldn't lose any information from the image.

jessiemmichael
18th June 2011, 15:56
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

wysota
18th June 2011, 16:32
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