Image rotation algorithm

algorithmimage manipulationjava-memidpoptimization

I'm looking for an algorithm that rotates an image by some degrees (input).

public Image rotateImage(Image image, int degrees)

(Image instances could be replaced with int[] containing each pixel RGB values,
My problem is that i need to implement it for a JavaME MIDP 2.0 project so i must use code runnable on JVM prior to version 1.5
Can anyone help me out with this ?

EDIT: I forgot to mention that i don't have SVG APIs available and that i need a method to rotate by arbitrary degree other than 90 – 180- 270

Also, no java.awt.* packages are available on MIDP 2.0

Best Answer

One of the best pages describing image rotation algorithms I've found on the internet is tied to Dan Bloomberg's excellent leptonica library. While the leptonica library itself is written in C and won't help you, his page on image rotation algorithms:

is definitely worth a read. You will most likely want to implement something like the Rotation by Area Mapping algorithm he describes in the second portion of the page.