determining size of drawn text

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

determining size of drawn text

John Alexander-7
Hi everyone -

I am using the drawString() function to print the name of the path/file
I am processing.  The image I am drawing on is of a known size (1300
pixels wide).

The problem is that on occasion I run across a file whos path/name is
longer than the width of the image - and so much of it is not seen.

Currently I use SansSerif size 18.

I would like to calculate the width in pixels of the text string first,
and if it is greater than 1300, use a smaller font size.

Is this possible?

John


--
John K. Alexander, Ph.D.
Post-Doctoral Fellow
William Green Laboratory
University of Chicago
Dept. Neurobiology, Pharmacology, and Physiology
947 East 58th Street
Abott Hall 402
Chicago, IL 60637
(off) 773-702-9386
(fax) 773-702-3774
[hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: determining size of drawn text

Wayne Rasband
On May 16, 2008, at 12:13 PM, John Alexander wrote:

> Hi everyone -
>
> I am using the drawString() function to print the name of the path/file
> I am processing.  The image I am drawing on is of a known size (1300
> pixels wide).
>
> The problem is that on occasion I run across a file whos path/name is
> longer than the width of the image - and so much of it is not seen.
>
> Currently I use SansSerif size 18.
>
> I would like to calculate the width in pixels of the text string first,
> and if it is greater than 1300, use a smaller font size.
>
> Is this possible?

Use the getStringWidth(string) function, which returns the width in
pixels of the specified string. This function has existed for a long
time but it was not on the list at
http://rsbweb.nih.gov/ij/developer/macro/functions.html until today.

-wayne
Reply | Threaded
Open this post in threaded view
|

Image Type RGB48

Guerda Massillon
Hi Wayne,


1. I have some images whose type is RGB48, When I do import row, i  
don't find this option in imageJ, What can I do?

Guerda

--
Guerda Massillon-JL, Ph.D.    *
Instituto de FĂ­sica UNAM      *
A.P. 20-364                   *
Mexico 01000 DF               *
Mexico                        *
Ph:(+52)(55)5622-5053
FAX:(+52)(55)5616-1535


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.