Login  Register

Re: Help to save open image in Process>Batch>Macro

Posted by Tiago Ferreira-2 on Jun 27, 2013; 4:29am
URL: http://imagej.273.s1.nabble.com/Help-to-save-open-image-in-Process-Batch-Macro-tp5003285p5003673.html

Dear Simone,

On 2013.06.07, at 13:47 , sdegan wrote:
> However, this allows me to choose a directory and save only one image at a time.
> Every time I am prompted to choose the directory and save the image:

Using getDirectory() without arguments is equivalent of using getDirectory("Choose a Directory"),
i.e., it will trigger a prompt for user-selected directory.

> Is there a way to have the resulted image from the batch to be saved automatically in a specified directory?

Sure. Have a look at http://imagej.nih.gov/ij/developer/macro/functions.html#getDirectory

Thus, in your macro you could use:

  // to save the jpg copy next to loaded image
  fullpath = getDirectory("image");

  // to save the jpg on the User's home folder
  fullpath = getDirectory("home");

  // to save the jpg on the subdirectory "output" of the home folder
  fullpath = getDirectory("home") + output + File.separator;  

  // to save the jpg on some fixed location
  fullpath = "Path/To/Some/Fixed/Folder/;


HTH,
-tiago
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html