Beanshell Basics

Hi all,
I have a very basic questions about beanshell. I would like to process some images, and to do this I have to first crop them. I tried, but this only works if I first open the image by hand. name of image, “Specify…”, “width=1024 height =1024 x=512 y=512”);
etc doesn’t work, and just putting name of image) before doesn’t work either, because bsh closes the image before processing the next line.

Here is a small example which opens an example image, makes a copy, a ROI selection and then crops the image:

imp = IJ.openImage("");;
imp2 = imp.duplicate();
imp2.setRoi(61,51,157,119);, "Crop", "");;
1 Like

Thanks so much! It really helped :slight_smile: