top of page

ImageJ-Fiji Quick Tip #1: Convert images as a batch

Keeping the raw format (e.g. nd2, lif, czi, oib, etc.) for your microscopy images is recommended to keep important acquisition information, such as pixel size, etc. However, you might need to convert them all at some point. Here is a quick tutorial post on how to do this as a batch in ImageJ / Fiji.


  • ImageJ users: you need the Bio-Formats plugin to read several raw formats. To know if you need it, a quick test is to open one image and see if it opens successfully. In any case, downloading the "Bio-Formats Package" jar file and putting it in your \ImageJ\plugins\ folder to replace the existing one is always a good thing.

  • Fiji users: go to menu "Help > Update" to ensure your Bio-Formats version is up-to-date.

No-code Version

For simple conversion to .tif files, follow these steps:

  1. Open ImageJ or Fiji

  2. Go to menu "Process > Batch > Convert..."

  3. Choose the input folder where your files are, and also choose an output one

  4. Keep all options as default, except "Read images using Bio-Formats" that you can check

  5. Press "Convert" and enjoy your new images

Spicy Version = add some processing steps

As you quickly noticed, you have some nice options to add some processing steps during that conversion in the previous dialog window. You can add more steps or just different ones by using the menu:

"Process > Batch > Macro..."

In that case, the dialog window offers you to either pick some predefined actions in the drop-down menu named "Add macro code". This might require some knowledge about macro language (see this page), but a nice one is that any action in ImageJ menus that is not ending with "..." in its name can be run with:


Below is an example with "Image > Type > 16-bit". You can also notice that any line starting with "//" is deactivating the action.

This becomes a "comment" in the code...

Extra tips:

  • You can easily filter out some specific files thanks to the field "File name contains:"

  • You can save your piece of code with the "Save..." button at the bottom.

  • "Test" button allow you to try the code on the first image in the input folder.

Additional Thoughts

You can easily capture your actions with the "Record" window. To find it, right-click on any image. You can then copy/paste some code in the window above...

Also, more advanced users might want some more complex conversion or file handling steps. We can think about the fact that more and more microscopes are saving multiple images (i.e. multiple Field-Of-View) as a single file. This is what you would see when opening this kind of file through Bio-Formats:

If you want to handle this in a customized way, you would need to use a proper macro.

Here are some code examples:

  • to open an image...

fs = File.separator;
MyPathToFile = "C:"+ fs +"ImageJ"+ fs +"MyImages"+ fs +"myacquisition.lif";
run("Bio-Formats Importer", "open=[" + MyPathToFile +"] autoscale color_mode=Grayscale view=Hyperstack stack_order=Default");
  • to get access to the "API" (see the help with "Plugins > Bio-Formats > Bio-Formats Macro Extensions"), by the use of macro extensions...

run("Bio-Formats Macro Extensions");
for (i=0; i<Mylist.length; i++) {
	Ext.setId(Mypath + Mylist[i]);

You can check here the full code example here ("Export-as-individual-images_1.5.ijm"):


bottom of page