Batch processing in Headless mode

imagej
batch-processing
headless

#1

Let say I have a nice macro, that takes one image as input and perform some processing.
Now I want to apply this processing to a bunch of images ie Batch processing, in headless mode since
the commands will be called by another program.

I though of 2 ways of doing this :

1) Calling the macro in headless mode as many time as there are images
Yet, I was wondering if this could be slow because some ImageJ routine is initialised and closed every time.
Unless if there are some flag that I can add in the command to prevent the closing of the underlying ImageJ processes.

2) Using an extra batch-processing macro
So that I only do one command line call to Fiji, and this batch macro itself calls the routine script. This would prevent to initialise/terminate the Fiji process every time.

Yet in the second option I loop sequentially on the image while in the first option maybe I can call the script with another image before the previous one is over, doing some kind of parallel execution to some extent.

What about with other programming languages ? let say I use a real python installation, is it fine to do

python script.py -Image1
python script.py -Image2

or is it better to have

python BatchScript.py -ImageList.txt