Short Description
Perform a snapshot and save the result into the selected file.Versions
-
Version 1 • Released on: 2013-03-11 15:23:14DownloadDescription:
initial version
importClass(Packages.plugins.tprovoost.scripteditor.uitools.filedialogs.FileDialog) importClass(Packages.icy.image.IcyBufferedImage) importClass(Packages.icy.file.FileUtil) importClass(Packages.icy.file.Saver) importClass(Packages.java.io.File) /* * In Icy, the snapshot feature is a part of the viewer, * not the sequence. Indeed, the sequence is a container, * only the viewer displays the image. */ // get the viewer and test if exists. viewer = gui.getFocusedViewer() if (viewer == null) throw "No sequence opened" // Get the rendered Image img = viewer.getCanvas().getRenderedImage(viewer.getT(), viewer.getZ(), -1, false) img = IcyBufferedImage.createFrom(img) // Open a File Dialog for saving, and test if selected one. file = FileDialog.save() if (file == null) throw "No file selected" // Check if the file has an extension. Add .png if not. if (FileUtil.getFileExtension(file.getPath(), false) == "") file = new File(file.getAbsolutePath() + ".png") Saver.saveImage(img, file, true)