from ij import IJ imp = IJ.getImage() print("Image dimensions: {} x {}".format(imp.width, imp.height))
from ij import IJ imp = IJ.getImage() duplicated_imp = imp.duplicate() new_name = "new_image.tif" IJ.saveAs(duplicated_imp, "Tiff", new_name)This code uses IJ.getImage() to get the current image and assigns it to the variable 'imp'. It then duplicates the image using the .duplicate() method and assigns the new image to 'duplicated_imp'. Finally, it saves the duplicated image with a new name using IJ.saveAs(). Package library: ImageJ