Batch Conversion ImageJ


I need a Macro code for imageJ or ImageJ-FIJI to convert Tiff stacked image to AVI file with 60FBS, to convert all stacked image files at once.

appreciate your helps

1 Like

Hey @Waseem,

just activate the Macro recorder in Fiji via Plugins > Macros > Record before opening a TIF file and saving it via File > Save As AVI. You can then take this macro and apply it to a whole folder of TIF files as explained here:

Let us know if this helps!


1 Like

Hi @haesleinhuepf
thank you for your reply,

I followed the mentioned steps, and I have added the generated code from the recording but nothing happened, just a dialog box appeared to select “Output directory”

the below is the run code,
Appreciate your help

 * Macro template to process multiple open images

#@ File(label = "Output directory", style = "directory") output
#@ String(label = "Title contains") pattern


 * Processes all open images. If an image matches the provided title
 * pattern, processImage() is executed.
function processOpenImages() {
	n = nImages;
	for (i=1; i<=n; i++) {
		imageTitle = getTitle();
		imageId = getImageID();
		if (matches(imageTitle, "(.*)"+pattern+"(.*)"))
			processImage(imageTitle, imageId, output);

 * Processes the currently active image. Use imageId parameter
 * to re-select the input image during processing.
function processImage(imageTitle, imageId, output) {

    run("AVI... ", "compression=None frame=60 

	// Do the processing here by adding your own code.
	// Leave the print statements until things work, then remove them.
	print("Processing: " + imageTitle);
	pathToOutputFile = output + File.separator + imageTitle + ".png";
	print("Saving to: " + pathToOutputFile);
1 Like

This code line suggests you want to process all images on your screen… How many are there?

If it’s your first time recording and editing a macro, you may want to take a short tutorial:

And here you can learn how to apply your macro to a folder of images:

Let us know if we can help further!


@haesleinhuepf Thank you so much, I really learned a lot from these videos.

I have around 250 stacked image files for each experiment and I have to repeat it triple times,
can you please help me with this, to have the accurate code to convert them all from stacked images to AVI video for further analysis.

this is the generated code from recording

run("AVI… ", “compression=None frame=60 save=C:/Users/whasan/Desktop/Job/CSPG4/CSPG4/CSPG4_Exp1/20190929_casper/test/20190219_CSPG4_100X_emb__1_MMStack_Pos0.ome.avi”);

appreciate your help, and really thank you

1 Like