Flatten: Toggling antialiasing does not work for "makeArrow"

Hello everyone,
I tried to keep the “flatten” command used in an ImageJ macro from antialiasing some selections such as text, lines and arrows (ImageJ 1.51n, Fiji).
But there seems to be no ijm-command to configure the rendering behavior of run("Flatten"). So I tried directly calling the instance method setAntialiasRendering of the ImagePlus class by some JavaScript-code.
As my exemplary ijm-code in the bottom shows, setAntialiasRendering influences lines, but apparently not the arrows. These are still having that semi-transparent pixels for antialiasing.
Does anybody know the reason or even a solution for that?

run("Blobs (25K)");
// Some demo objects...
setFont("SansSerif", 12);	
makeText("Test",100,53);	// Text
run("Add Selection...", "stroke=red");
makeLine(140, 80, 80, 60);	// Line
run("Add Selection...", "width=1 stroke=red");
makeArrow(140, 60, 80, 40,"Filled Small Double");	// Arrow
run("Add Selection...", "width=1 stroke=red");
run("Select None");
// Example without antialiasing:
selectImage("blobs.gif");
// Toggles the antialiasing mode by an inline call of js-code via "eval(...)": imports ImagePlus class, 
// gets handle of active image and toggles the antialiasing mode by calling the according "instance method"
// "setAntialiasRendering". 0 - antialiasing off, 1 - antialiasing on :
eval("script","importClass(Packages.ij.ImagePlus);IJ.getImage().setAntialiasRendering(0);");
run("Flatten");	// The flattening command to be configured by preceding eval-command.
makeRectangle(60, 30, 100, 70);	
run("To Selection");	// Zooms to selection.
run("Select None");
// Same example with antialiasing:
selectImage("blobs.gif");
eval("script","importClass(Packages.ij.ImagePlus);IJ.getImage().setAntialiasRendering(1);");
run("Flatten");	// 
makeRectangle(60, 30, 100, 70);	
run("To Selection");	// Zooms to selection.
run("Select None");
1 Like

This bug is fixed in the latest ImageJ daily build (1.51s5).

Note that the importClass() call is not needed in the JavaScript code that disables/enables antialiasing.

eval("script","IJ.getImage().setAntialiasRendering(false);");

2 Likes

Thank you very much for the quick bugfix and also for the note with that optimized line of JS-code!