Example Code

Rotating Graphics (Pixmaps) in LabVIEW

Code and Documents

Attachment

The attached LLB contains the Rotate Pixmap VI, which you can use to rotate any 2D pixmap by any specified angle. It does so by generating a new pixmap array and calculating the correct pixel for every index. Images might degrade if you feed them repeatedly through the VI. If you want to rotate an image several times, it is good practice to maintain and use a copy of the original image.

The LLB also contains a Picture Control to 2D Pixmap VI, which you can use to convert the image in a picture control to a pixmap for easier manipulation.

NOTE: These VIs are processor and memory intensive. Execution speed depends heavily on the size of the image and the speed of the computer. If rotating a simple picture control or if rotating a pixmap by 90 degree increments, the attached examples might offer more efficient methods.

Also attached are three examples. You must have the Rotate.llb to use these examples. The Image Spin VI rotates a BMP, PNG, or JPG image and animates the rotation. The Rotate Picture Control VI uses the Picture Control to 2D Pixmap VI to convert and manipulate a picture control im age. The Picture Dial VI combines a picture control with a rotating knob or dial control.


Related Links:
Rotate 2D array 90 degrees

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors