How to draw String on image

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to draw String on image

Amol Patil
Hi ,

I have one application which uses ImageJ library internally to perform image
modification operations.I have implement many operation like

Zoom in zoom out,flip,drawrectangle.

But when I use drawstring() method my program does not terminate and also
does not show excepted output.

If anybody has done it please send me sample code here my sample code which
I am using for this operation.

 

RankFilters filter = new RankFilters();

            Opener open=new Opener();

            ImagePlus image=open.openImage(fileName);

            ImageProcessor ipr=image.getProcessor();

            ipr.setInterpolate(true);

ipr.drawString("Test");

 

After that I am saving image.

Please check this code Send me correct code.

Thanks in advance

 
Reply | Threaded
Open this post in threaded view
|

Re: How to draw String on image

Michael Schmid
Hi Amol,

did you set the position where to draw the string?
   ipr.moveTo(x, y); ipr.drawString("Test");
or
   ipr.drawString("Test", x, y);


Michael
________________________________________________________________

On 22 May 2007, at 09:16, Amol Patil wrote:

> Hi ,
>
> I have one application which uses ImageJ library internally to  
> perform image
> modification operations.I have implement many operation like
>
> Zoom in zoom out,flip,drawrectangle.
>
> But when I use drawstring() method my program does not terminate  
> and also
> does not show excepted output.
>
> If anybody has done it please send me sample code here my sample  
> code which
> I am using for this operation.
>
>
>
> RankFilters filter = new RankFilters();
>
>             Opener open=new Opener();
>
>             ImagePlus image=open.openImage(fileName);
>
>             ImageProcessor ipr=image.getProcessor();
>
>             ipr.setInterpolate(true);
>
> ipr.drawString("Test");
>
>
>
> After that I am saving image.
>
> Please check this code Send me correct code.
>
> Thanks in advance
>
>