Re: Clearing text from image
Posted by
Rasband, Wayne (NIH/NIMH) [E] on
Mar 27, 2010; 4:39am
URL: http://imagej.273.s1.nabble.com/Clearing-text-from-image-tp3688768p3688769.html
On Mar 26, 2010, at 11:09 PM, Benn, Douglas K. wrote:
> Could anybody please tell me if there is a simple way to clear a text string written as a label onto an image using drawString() ? I tried writing the same string but with 0,0,0 as the color - I am assuming that is black. I cannot find a simple description of how overlay text is represented. I thought of importing the original image slice but this seems very clumsy so I expect there are easier ways. Also is there a description of different colors and their numeric representations?
The drawString() macro function destructively renders the text onto the image. Use makeText() and the Image>Overlay>Add Selection command to display text using a non-destructive overlay. Here is a macro that displays "Hello" in red as an an overlay, clears it two seconds later, and two seconds after that displays "Goodbye" in green.
requires("1.43p");
makeText("Hello", 50, 50);
run("Add Selection...", "stroke=red font=48 new");
run("Select None");
wait(2000);
run("Hide Overlay");
wait(2000);
makeText("Goodbye", 50, 50);
run("Add Selection...", "stroke=green font=48 new");
run("Select None");
Another example is at
http://rsbweb.nih.gov/ij/macros/examples/BlinkingText.txt-wayne