Re: rotate a bitmap image
What do you mean if it were an image with a header?
Cheers,
_
Re: rotate a bitmap image
Quote:
Originally Posted by
anda_skoa
What do you mean if it were an image with a header?
Cheers,
_
if it is PNG or JPEG we can set it the QByteArray to a pixmap or QImage like:
Quote:
image->loadFromData(bytes, "PNG");
but when it is raw data of 800 by 600 by 3, it has no header, it is not PNG or of any type anymore. I wonder how I can rotate the image by 90 degree in this case!
Cheers,
Re: rotate a bitmap image
But you still know how to access the pixel(i,j), and how to display the data ? What is the pixel data layout now ?
Another thing, how do you display the data ? If you need the rotation only for display, and you are using opengl, you can rotate it by simple glRotate(...) before pixmap rendering code.
Re: rotate a bitmap image
Quote:
Originally Posted by
saman_artorious
but when it is raw data of 800 by 600 by 3, it has no header, it is not PNG or of any type anymore. I wonder how I can rotate the image by 90 degree in this case!
At the time when transformed() is called with the rotation matrix, there is just QImage, so it always works the same way.
QImage works on pixel data, not on whatever source format. The source format is only important for getting the pixel data into the QImage instance.
Since you are asking about the rotation step, which is after loading, I assume you have the loading covered.
So the answer to your question is: create a rotation matrix, call QImage::transformed()
Cheers,
_