// This macro opens and inverts 20 images,
// verifying that the image was actually inverted. 
// ImageJ 1.31c fixes a synchronization bug that
// caused this macro to sometimes fail on Mac OS X. 

  n = 20;
  for (i=1; i<=n; i++) {
      newImage(""+i, "8-bit", 100, 100, 1);
      run("Invert");
      if (getPixel(0,0)!=0)
          print("Synchronization error: "+i);
 }
  for (i=n; i>=1; i--) {
      selectWindow(""+i);
      run("Close");
 }

 

