Batch export from ImageJ

I have more than a 100 multi-page TIFFs which I would like to apply a median filter on and export to a file. I can do this at the moment for individual images but I cannot apply this for batch processing. Is there a way of batch processing the Export function? The save function works but the images saved don’t have the correct information needed, which is why I need to use the Export function as this reserves the quality of the images. Many thanks.

This is the fast solution:

run("Image… ", “outputfile=C:\Users\SomeUser\Desktop\Composite.tif display=Composite.tif”);

generated by the macro recorder (File => Export => Image…)

Let me know if it works

This was a bit more complicated, but when I used the save function like this (to merge a bunch single channel TIFFs), it worked just fine. It might be because I set the properties first, though I am not sure how yours are being lost.
Script base taken from… here.

dir1 = getDirectory("Choose Source Directory ");
dir2 = getDirectory("Choose Destination Directory ");

setBatchMode(true);
channelList = getFileList(dir1);
batchList = getFileList(dir1+channelList[0]);
//Open groups of files, one per channel for a set
for (j=0; j<batchList.length; j++){
	imageList = getFileList(dir1+channelList[0]+batchList[j]);
	for (k=0; k<imageList.length; k++){
		for (i=0; i<channelList.length; i++) {
			//print(dir1+channelList[i]+batchList[j]+imageList[k]);
			open(dir1+channelList[i]+batchList[j]+imageList[k]);
			rename(channelList[i]);
			run("8-bit");
			run("Properties...", "channels=1 slices=1 frames=1 unit=um pixel_width=0.5 pixel_height=0.5 voxel_depth=1");
		}
		run("Images to Stack", "name=["+imageList[k]+"] title=[] use");
		run("Properties...", "channels=6 slices=1 frames=1 unit=µm pixel_width=0.5000000 pixel_height=0.5000000 voxel_depth=1.0000000");
		saveAs("TIFF", dir2+imageList[k]);
		while (nImages>0) { 
          selectImage(nImages); 
          close(); 
        } 
	}
}

Did you use saveAs(“TIFF”, location)? You probably don’t need most of the rest of that stuff, but I wanted to keep it in context.