// defaults to .png static File saveInImageDirectoryWithCounter(S subPath, BufferedImage img) { if (img == null) null; assertNempty(subPath); File dir = imagesDir(); if (!isImageFileName(subPath)) subPath += ".png"; File f = makeFileNameUnique_beforeExtension_startWith1_noDot(newFile(dir, subPath)); saveImage(f, img); infoBox("Saved image " + appendBracketed(img.getWidth(null) + "*" + img.getHeight(null)) + ": " + fileInfo(f)); ret f; }