Skip to content

Rotating images

Ralph Niemitz edited this page May 18, 2017 · 2 revisions

It is as easy as it could be. Just call the rotate(double) method and say by how much degrees it should rotate. Optional you can also say what algorithm to use, how big the resulting image and/or where the center of rotation is. By default the used algorithm is nearest neighbour interpolation and the center and size of the original image are used as new size and center of rotation.

Example:

SimpleImage orig = new SimpleImage("myImage.jpg");
SimpleImage rotated = orig.rotate(90, SimpleImage.ROTATE_NEAREST_NEIGHBOUR);

Original:
Original

Rotated:
Rotated

Clone this wiki locally