MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / saveAsTiff

Method saveAsTiff

ij/src/main/java/ij/IJ.java:2267–2283  ·  view source on GitHub ↗

Saves the specified image in TIFF format. Displays a file save dialog if 'path' is null or an empty string. Returns 'false' if there is an error or if the user selects "Cancel" in the file save dialog.

(ImagePlus imp, String path)

Source from the content-addressed store, hash-verified

2265 if 'path' is null or an empty string. Returns 'false' if there is an
2266 error or if the user selects "Cancel" in the file save dialog. */
2267 public static boolean saveAsTiff(ImagePlus imp, String path) {
2268 if (imp==null)
2269 imp = getImage();
2270 if (path==null || path.equals(""))
2271 return (new FileSaver(imp)).saveAsTiff();
2272 if (!path.endsWith(".tiff"))
2273 path = updateExtension(path, ".tif");
2274 FileSaver fs = new FileSaver(imp);
2275 boolean ok;
2276 if (imp.getStackSize()>1)
2277 ok = fs.saveAsTiffStack(path);
2278 else
2279 ok = fs.saveAsTiff(path);
2280 if (ok)
2281 fs.updateImagePlus(path, FileInfo.TIFF);
2282 return ok;
2283 }
2284
2285 static String updateExtension(String path, String extension) {
2286 if (path==null) return null;

Callers 1

saveAsMethod · 0.95

Calls 7

getImageMethod · 0.95
updateExtensionMethod · 0.95
saveAsTiffStackMethod · 0.95
saveAsTiffMethod · 0.95
updateImagePlusMethod · 0.95
equalsMethod · 0.45
getStackSizeMethod · 0.45

Tested by

no test coverage detected