Sudden Macro Error 'No Image'

Sudden Macro Error ‘No Image’

Dear Community,

I reached the end of my capabilities on this one and I need your help.
I wrote a macro for simple intensity measurements and have been using it repeatedly over the last week on multiple datasets. Today I suddenly encountered the ‘No Image’ error and a weird text window (screenshot below).
Basically, the macro stops after a couple of images. I boiled the macro down to the bare minimum, tried a different Fiji installation, different images, different input folder, restarted the computer…

This is the MWE:

input = getDirectory("Choose an input directory");
output = getDirectory("Select an output directory");

function processFolder(input) { 
	list = getFileList(input);
	sorted = Array.sort(list);
	for (i=0; i<list.length; i+=2) {
		processFiles(input, output, list[i], list[i+1]);	

function processFiles(input, output, filename1, filename2) {
      	open(input + filename1);
  	    open(input + filename2);
  	    print(DAPI + "-" + TPM);
  	    run("Close All");


Did anyone else encounter this? Am I not seeing something obvious? Does anyone have an idea what I am doing wrong here?
Any help will be greatly appreciated! :slight_smile:

I wonder if for some reason the image is not opened, or takes too long and so the next command does not find any image.
I have no idea if that is the case, but perhaps put a timer between the two (try a larger value, to give time for the image to be opened).
Sorry if that is not the solution.

open(input + filename1);
open(input + filename2);
print(DAPI + "-" + TPM);

Just a guess because you mentioned it worked with other images. Try to change some image filenames for a test.
It could be that some chars in the filename are causing the error. At least this is indicated in your
first screenshot.

It would also make sense to post a reproducible example (images and macro).

Thanks, to both of you for the quick answers! I tried them both and it solve the issue. BUT I noticed something else:

The files that show up in this weird unnamed window as LocalizedFileNames are not the filenames of the images that I have in my input folder! Is there something like a “Cache” in Fiji, where I can delete all stored information?

To me, this looks like you (unintentionally) opened the desktop.ini file from your folder (which contains a section [LocalizedFileNames], see here).

I suggest you check for a file extension in your batch processing loop, as it’s suggested in the Process Folder macro template (Templates > ImageJ 1.x > Batch > Process Folder (IJ1 Macro) in the menu of the script editor):

Genius! That did it!
I compared the folder content in a different program and found the desktop.ini - deleted it, now it runs. :slight_smile:
I’ll implement the check for file extensions in the future, thanks for posting it.

So, problem solved, thanks to all of you, have a wonderful weekend! :heart:

Glad to hear that solved it!

Just note that your operating system can (and will) re-create this hidden desktop.ini file any time. So implementing the file extension check if probably safest :wink: