Login  Register

Re: automated font manipulation and textbox placement

Posted by Christine Labno-2 on Nov 13, 2014; 5:01pm
URL: http://imagej.273.s1.nabble.com/automated-font-manipulation-and-textbox-placement-tp5010414p5010420.html

Hello Joe,

I was able to record this using ImageJ 1.49j on Windows 7 using the Blobs sample image, but had to go to completion of the procedure before getting any code.  It does run as a macro.  You should be able to use it as a starting point, swapping out commands to get exactly what you want.  

------begin----------------

text="charater string"  //sets up variable name to pass character string
setFont("SansSerif", 12, " antialiased");   //font, size and smoothing
setColor("black");
drawString(text, 20, 50);  //if no variable, text to be printed goes in "", x position, y position

----------end-------

Best,
Christine

--------------------------------------------
Christine Labno, Ph.D.
Asst. Technical Director
Light Microscopy Core
University of Chicago
Office of Shared Research Facilities
KCBD 1250 900 E. 57th St.
(773) 834-9040 (phone)

________________________________________
From: ImageJ Interest Group [[hidden email]] on behalf of Joe Vandergracht [[hidden email]]
Sent: Thursday, November 13, 2014 10:15 AM
To: [hidden email]
Subject: automated font manipulation and textbox placement

Hello,

I am looking for help to do the following in a plug-in

Specify the font size and deselect smoothing
Select text tool and specify the location and size of the text box

as a bonus it wold be nice to automatically pass a character string to the text box and apply, but I am okay with the user having to enter it and hit Ctrl-D.

I tried turning the macro recorder on and performing those actions, but the recorder did not register anything but selecting the text tool and gave me the command

IJ.setTool("text");

thanks,

Joe vanderGracht

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html