/* N.Vischer 16.11.16 16:23 Macro tests all .tif images in a folder (not sub-folders). Images that contain overlay or selection are re-saved without overlay or selection. Note: this macro is mainly intended for Nikon files that contain unwanted overlays after acquisition. In other cases, overlays may be important. */ macro "Remove Overlay from all images in Folder"{ if (nImages >0) if(!getBoolean("Close all open images without saving?")) exit; run("Close All"); dir= getDirectory("Select Directory"); titles = getFileList(dir); count = 0; for(img = 0; img < titles.length; img++){ name = titles[img]; if(endsWith(name, ".tif")){ open(dir + name); rename(name);//avoid suffix if(getInfo("overlay") != "" || selectionType >=0){ run("Remove Overlay"); run("Select None"); saveAs("Tiff", dir+name); count++; } close; } } showMessage("Overlay or selection removed on " + count + " image(s)"); }