Here is one simple example:
import ij.IJ;
import ij.ImagePlus;
import ij.plugin.PlugIn;
public class My_Plugin implements PlugIn {
public void run(String arg) {
ImagePlus imp = IJ.openImage("https://imagej.net/images/blobs.gif");
IJ.run(imp, "Rotate... ", "angle=45.10 grid=1 interpolation=Bilinear");
imp.show();//Show image
}
}
You simply operate on the ImagePlus object or copies of it if necessary (imp.show() opens the final image).
There is also a Rotator class which can be used directly. But with the Java recorder you aim and shoot.
For a stack the recorder gives (with the mri-stack example and default options):
imp = IJ.openImage("https://imagej.net/images/mri-stack.zip");
IJ.run(imp, "Rotate... ", "angle=45.10 grid=1 interpolation=Bilinear stack");