How to work with ImageJ and python

Hi all of you

I have tried to work with python in order to write scripts for imageJ, and I have tried some ways.

I tried with fijibin module but I didn’t success to get stable code becaues I get error all the time.

I tried to work with Eclipse in order to work with Jython from this IDE so that I will have a debuger and easier editor but I failed to run a script, the tutorial in the imageJ site is not good enough so I decided to work with the editor script of the imageJ with Jython(python) cause I know this language.

I have two qeustions:

  1. How do you write scripts for the imageJ (Macro,Java,Python) and why?
    2.Do you know a good tutorial for the Jython and imageJ ,I mean things like functions, OOP and modules,
    I didn’t find a good one that explain this subject deeply.

Thnks in advance

As suggested on the Gitter channel by @gab1one should give you a start



For Jython Scripting - check out this page on the ImageJ Wiki:

In general, the Development page is a great “home-base” for finding resources for scripting, etc:

And for ImageJ Ops:

Read up and if you have SPECIFIC questions, feel free to post again!

eta :slight_smile:

Thnak you about the fast answer

I have tried thos pages but they are very summary, they don’t explain about all the function of Jython in imageJ (I mean commands like open image, change contrast, make stacks ans so on) and the modules.

Besides there is no Debuger in this Jython and it is very inconvenient

@microb1 There are some Jupyter notebooks illustrating the ImageJ API here:

You can run them live in the cloud using this link:

The examples are mostly in Groovy, but they should work in Jython also with no—or nearly no—syntax changes in most cases. The API is identical; the only differences would be which syntax works with which language (e.g., construction of lists, maps, and so forth).

1 Like


How about the ImageJ2 Python Scripts page?

That link was referenced on the Jython Scripting page linked above… There are tons of goodies like these linked from the above pages…