Scale bar macro problems
Posted by Nick Holway on Sep 04, 2008; 2:04pm
URL: http://imagej.273.s1.nabble.com/Scale-bar-macro-problems-tp3695175.html
Hi,
I'm trying to write a macro which puts a scale bar on all the images in a
directory. I've borrowed bits from the Bacth Convert macro.
run("Set Scale...", "distance=1 known=1 pixel=1 unit=um");
dir1 = "C:\\imagejdev\\original\\";
dir2 = "C:\\imagejdev\\output\\";
list = getFileList(dir1);
setBatchMode(true);
for (i=0; i<list.length; i++) {
showProgress(i+1, list.length);
open(dir1+list[i]);
run("Scale Bar...", "width=100 height=5 font=18 color=Black background=None
location=[Lower Right] bold");
saveAs("TIFF", dir2+list[i]);
close();
}
I have a couple of problems with this:
* If there is no image open, then a dialog warns you of this
* If the macro opens a JPEG then the scrip works properly, if it opens a tif
then the scale line extends from the LHS of the image to the RHS of where it
should end
I'm using the v1.41 of the MBF build on Windows XP SP2 and I also tried
Imagej 1.41 with the MBF plugins on Centos 5.2. I had the same problems on
both platforms. FWIW the files were originally created under Windows.
Does anyone know how to get around these problems?
Thanks
Nick