Login  Register

Adding text "Destructively" to the image

Posted by davek604 on Feb 03, 2016; 3:07pm
URL: http://imagej.273.s1.nabble.com/Adding-text-Destructively-to-the-image-tp5015530.html

Hello

I'm writing a plugin to add text permanently to an image. It forms part of a loop which moves through an image stack adding numbers (as text) where required. I'm using the code below to add the text

               String TheText = Integer.toString(count);
        Font font = new Font("SansSerif", Font.PLAIN, 9);
        TextRoi roi = new TextRoi(Xval, Yval, TheText, font);
        roi.setStrokeColor(Color.white);
        Overlay overlay = new Overlay();
        overlay.add(roi);
        Dupimp.setOverlay(overlay);

This adds the text as an overlay which can't then be made part of the image. The Draw command will do this but the text would have to be a selection which I can't work out how to do. Any suggestions as to how I can make the text permanent would be appreciated.

Regards

David