Rotate a bitmap image in portrait mode by 90 degrees
gogeta last edited by r_gigante
How can I rotate a rendered bitmap image in portrait mode by 90 degrees using C++ APIs?
I am able to render the current document in landscape mode and can see it in picture viewer. Also I am able to render the current document in portrait mode but I want to rotate the portrait mode by 90 degrees so that the portrait mode can be seen in rotated form. For example: I set the resolution for rendering as 1280x720 in landscape mode and 720x1280 in portrait mode. Now when I see the rendered output in portrait mode in 720x1280 resolution, I want this to be rotated by 90 degrees and see it as 1280x720 resolution with rotated mode. Please help me to achieve this.
I am using R19 SDK and C++ for development.
Thanks in advance.
a_block last edited by
we are wondering about the exact use case. Depending on this there are different solutions possible.
When first reading your post, I thought, I'd probably tackle this with a second rotated camera. You'd basically render out the exact aspect ratio and rotation you need. And the Take System might help to organize the cameras and render settings.
Second option may be the "Remote" post effect. This can be added in the Render Settings to pass a rendered image to another application. For example Image Magick comes to my mind as very nice and free collection of command line tools to manipulate images.
But then maybe you want to render via code (RenderDocument()) and rotate the resulting BaseBitmap directly. There's no API function to rotate the image, sorry. But as you only need a 90 degree rotation, it's actually quite simple using nested loops to swap row and column pixels.
gogeta last edited by
@a_block Thank You so much Andreas !
I would like to try all the suggested approaches and hopefully I'll get my issue resolved (except second option is out of my context as I can't use another application). Third potion seems to be the best suited option and I would like to give it a try.