Hi again, I attach the code that I use, trying as wysota comments. The problem is that the rotation is done in 2D, so if I try to rotate an image 90º from the Y axis, the result is not a vertical line or even a null image
#include <QtGui>
#include <math.h>
int main(int argc, char *argv[])
{
double radians = 90 * 3.14159265 / 180; //rotation of 90º
imatge
= imatge.
transformed(QMatrix(cos(radians
),
-sin(radians
),
sin(radians
),
cos(radians
),
0,
0));
imatge.save("../transformated.jpg", "jpg");
return 0;
}
#include <QtGui>
#include <math.h>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QImage imatge("../test.jpg");
double radians = 90 * 3.14159265 / 180; //rotation of 90º
imatge = imatge.transformed(QMatrix(cos(radians),-sin(radians),sin(radians),cos(radians),0,0));
imatge.save("../transformated.jpg", "jpg");
return 0;
}
To copy to clipboard, switch view to plain text mode
I think that's not as easy as that code
Bookmarks