Sagewire Logo

how to convert metric to pixels

15 Message(s) by 10 Author(s) originally posted in java help


From: Rita Leon Date:   Thursday, October 25, 2007
What are the methods/classes in JFC to convert millimeters (or inches
or centimeters) to pixel s?

I remember in windows programming we had DPtoLP() and LPtoDP(). Might
there be a JAVA equivalent?

ty


From: Andrew Thompson Date:   Friday, October 26, 2007
wrote in message :
What are the methods/classes in JFC to convert millimeters (or inches
or centimeters) to pixels?
I remember in windows programming we had DPtoLP() and LPtoDP(). Might
there be a JAVA equivalent?



Odd. How did Windows know what physical screen size
I was using? Without that information (+ more info. on
screen resolution ), it'd be impossible to translate
between pixels and physcial units like mm or inches.

Why not simply 'decide' the initial number of px/mm, then
draw a grid of mm on-screen, and allow the end-user to change
the px/mm ratio as they need. For extra points, the program
might persist that ratio between runs.

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JAVAKB.com
http://www.JAVAkb.com/Uwe/Forums.aspx/JAVA-setup/200710/1


From: Thomas Fritsch Date:   Friday, October 26, 2007
wrote in message:
What are the methods/classes in JFC to convert millimeters (or inches
or centimeters) to pixels?
I remember in windows programming we had DPtoLP() and LPtoDP(). Might
there be a JAVA equivalent?
You can call


int resolution = Toolkit.getDefaultToolkit().getScreenResolution();
to get your physical screen resolution (on my screen I get 96). Having
that number, it is simple arithmetics to convert inches to pixels and
vice versa.

See
<http://JAVA.sun.com/j2se/1.5.0/docs/api/JAVA/awt/Toolkit.html#getScreenResolution()>

--
Thomas


From: Roedy Green Date:   Friday, October 26, 2007
wrote in message,
quoted or indirectly quoted someone who said :

I remember in windows programming we had DPtoLP() and LPtoDP(). Might
there be a JAVA equivalent?



see http://mindprod.com/jgloss/resolution.html
http://mindprod.com/jgloss/coordinates.html
--
Roedy Green Canadian Mind Products
The JAVA Glossary
http://mindprod.com


From: Rita Leon Date:   Friday, October 26, 2007
On Fri, 26 Oct 2007 04:09:42 GMT, "Andrew Thompson" <u32984@xxxxxxxxxxx>
wrote in message:

How Windows knows the number of pixels per unit of measure (like an
inch) depends on the age of the monitor . For really old CRT monitors
Microsoft probably just hard coded a best guess given an average pixel
size (ie. dot pitch) for all the possible resolutions.

For more recent monitors manufacturers can include the values in
device drivers. Windows might even be able to request that info
directly from a monitor via the data cable.

The idea of getting the user to measure a fixed unit on the screen is
not a bad idea but when my boss see's the user manual request "the
user find a ruler, hold it up to the monitor and eyeball a distance"
I'm gonna get laughed out of a job.

Odd. How did Windows know what physical screen size
I was using? Without that information (+ more info. on
screen resolution), it'd be impossible to translate
between pixels and physcial units like mm or inches.
Why not simply 'decide' the initial number of px/mm, then
draw a grid of mm on-screen, and allow the end-user to change
the px/mm ratio as they need. For extra points, the program
might persist that ratio between runs.






From: Rita Leon Date:   Friday, October 26, 2007
On Fri, 26 Oct 2007 09:50:44 GMT, Thomas Fritsch
wrote in message:

You idea is possible but the number of pixels per unit'll vary
depending on the physical size of the monitor and the size of a pixel.
A 17" monitor @xxxxxxxxxxx 1024x768 will have a different number of pixels per
unit than a 22" monitor @xxxxxxxxxxx 1024x768. And then there is the issue of
dot pitch...

ty for the suggestion.>You can call
int resolution = Toolkit.getDefaultToolkit().getScreenResolution();
to get your physical screen resolution (on my screen I get 96). Having
that number, it is simple arithmetics to convert inches to pixels and
vice versa.
See
<http://JAVA.sun.com/j2se/1.5.0/docs/api/JAVA/awt/Toolkit.html#getScreenResolution()>






From: Rita Leon Date:   Friday, October 26, 2007
On Fri, 26 Oct 2007 10:59:07 GMT, Roedy Green
wrote in message:

This must be it. thank you.
int dpi = Toolkit.getDefaultToolkit().getScreenResolution();

see http://mindprod.com/jgloss/resolution.html
http://mindprod.com/jgloss/coordinates.html






From: tar Date:   Friday, October 26, 2007
Rita Leon <dingo@xxxxxxxxxxx> writes:

On Fri, 26 Oct 2007 09:50:44 GMT, Thomas Fritsch
wrote in message:
You idea is possible but the number of pixels per unit'll vary
depending on the physical size of the monitor and the size of a pixel.



Yes, and if you had read the documentation that comes with
getScreenResolution, you would've seen that the value that is returned
is the number of pixels per inch. So the routine is already supposed to
have taken that into consideration.

Note that getScreenSize returns the dimensions in pixels, which is
different.> A 17" monitor @xxxxxxxxxxx 1024x768 will have a different number of pixels per
unit than a 22" monitor @xxxxxxxxxxx 1024x768. And then there is the issue of
dot pitch...
ty for the suggestion.
>You can call
> int resolution = Toolkit.getDefaultToolkit().getScreenResolution();
>to get your physical screen resolution (on my screen I get 96). Having
>that number, it is simple arithmetics to convert inches to pixels and
>vice versa.
>
>See
><http://JAVA.sun.com/j2se/1.5.0/docs/api/JAVA/awt/Toolkit.html#getScreenResolution()>



--
Thomas A. Russ, USC/Information Sciences Institute


From: Knute Johnson Date:   Friday, October 26, 2007
wrote in message:
On Fri, 26 Oct 2007 10:59:07 GMT, Roedy Green
wrote in message:
This must be it. thank you.
int dpi = Toolkit.getDefaultToolkit().getScreenResolution();
see http://mindprod.com/jgloss/resolution.html
http://mindprod.com/jgloss/coordinates.html



There is more to it than that. Windows keeps a DPI setting but it
does not really reflect the actual size of the screen in inches. On my
XP computer the DPI setting is 96 dots per inch and that is what is
returned by Toolkit.getScreenResolution(). My screen is set for
1024x768 and it is 13 1/4 inch by 10 3/4 inch. At 96 DPI the screen
should be 10 2/3 x 8 inches. As far as I know there is no way to
actually determine how many pixels will make up an inch on your display .

--

Knute Johnson
email s/nospam/knute/


From: Eric Sosman Date:   Friday, October 26, 2007
wrote in message:
On Fri, 26 Oct 2007 09:50:44 GMT, Thomas Fritsch
wrote in message:
You idea is possible but the number of pixels per unit'll vary
depending on the physical size of the monitor and the size of a pixel.
A 17" monitor @xxxxxxxxxxx 1024x768 will have a different number of pixels per
unit than a 22" monitor @xxxxxxxxxxx 1024x768. And then there is the issue of
dot pitch...



What is the pixel size when you are routing the display
to two or more output devices simultaneously? E.g., when you
are viewing your presentation on your laptop's 15-inch screen
while everyone else is watching the 10-foot projected image?

--
Eric Sosman
esosman@xxxxxxxxxxx


From: Patricia Shanahan Date:   Friday, October 26, 2007
wrote in message:
wrote in message:
On Fri, 26 Oct 2007 09:50:44 GMT, Thomas Fritsch
wrote in message:

You idea is possible but the number of pixels per unit'll vary
depending on the physical size of the monitor and the size of a pixel.
A 17" monitor @xxxxxxxxxxx 1024x768 will have a different number of pixels per
unit than a 22" monitor @xxxxxxxxxxx 1024x768. And then there is the issue of
dot pitch...
What is the pixel size when you are routing the display
to two or more output devices simultaneously? E.g., when you
are viewing your presentation on your laptop's 15-inch screen
while everyone else is watching the 10-foot projected image?



I'm typing this on a laptop with an external display connected, in
extended desktop mode, and the composition window placed so that it lies
across the boundary between the displays. The two displays have
different characteristics. What is the pixel size for this window?

I'm curious about the ultimate motive for caring about the size in
inches, as distinct from whether the user want to zoom in or out.

Patricia


From: Andrew Thompson Date:   Friday, October 26, 2007
wrote in message:
..
I'm curious about the ultimate motive for caring about the size in
inches, as distinct from whether the user want to zoom in or out.



I'll add my 'me too!' to that.

--
Andrew Thompson
http://www.athompson.info/andrew/

Message posted via JAVAKB.com
http://www.JAVAkb.com/Uwe/Forums.aspx/JAVA-setup/200710/1


From: Lew Date:   Saturday, October 27, 2007
wrote in message:
wrote in message:
...
I'm curious about the ultimate motive for caring about the size in
inches, as distinct from whether the user want to zoom in or out.
I will add my 'me too!' to that.



To cite the sound reasoning that Andrew usually proffers, the /strategy/, to
determine the size in cm. or in., may not be the best to achieve the /goal/,
as yet unstated.

--
Lew


From: RussellT Date:   Sunday, October 28, 2007
wrote in message

wrote in message:
wrote in message:
On Fri, 26 Oct 2007 09:50:44 GMT, Thomas Fritsch
wrote in message:
You idea is possible but the number of pixels per unit'll vary
depending on the physical size of the monitor and the size of a pixel.
A 17" monitor @xxxxxxxxxxx 1024x768 will have a different number of pixels per
unit than a 22" monitor @xxxxxxxxxxx 1024x768. And then there is the issue of
dot pitch...

What is the pixel size when you are routing the display
to two or more output devices simultaneously? E.g., when you
are viewing your presentation on your laptop's 15-inch screen
while everyone else is watching the 10-foot projected image?

I'm typing this on a laptop with an external display connected, in
extended desktop mode, and the composition window placed so that it lies
across the boundary between the displays. The two displays have
different characteristics. What is the pixel size for this window?
I'm curious about the ultimate motive for caring about the size in
inches, as distinct from whether the user want to zoom in or out.
Patricia



For my cad program, the schematic (could be electrical, instrumentation,
etc.), will be printed on 11x17" landscape, multiple sheets. Printed symbol
size is more or less an industry standard which follows from visual and
readable. Number of sheets required to organize a printed presentation is
related to how much can fit on a sheet. How could I ensure all that, unless
the 100% view on the monitor, is the actual printed page size? For this,
zooming is mostly a design time process, because the monitor size is less
than the printed page.

Russell


From: Patricia Shanahan Date:   Sunday, October 28, 2007
wrote in message:
wrote in message:
wrote in message:
On Fri, 26 Oct 2007 09:50:44 GMT, Thomas Fritsch
wrote in message:

You idea is possible but the number of pixels per unit'll vary
depending on the physical size of the monitor and the size of a pixel.
A 17" monitor @xxxxxxxxxxx 1024x768 will have a different number of pixels per
unit than a 22" monitor @xxxxxxxxxxx 1024x768. And then there is the issue of
dot pitch...
What is the pixel size when you are routing the display
to two or more output devices simultaneously? E.g., when you
are viewing your presentation on your laptop's 15-inch screen
while everyone else is watching the 10-foot projected image?
I'm typing this on a laptop with an external display connected, in
extended desktop mode, and the composition window placed so that it lies
across the boundary between the displays. The two displays have
different characteristics. What is the pixel size for this window?

I'm curious about the ultimate motive for caring about the size in
inches, as distinct from whether the user want to zoom in or out.

Patricia

For my cad program, the schematic (could be electrical, instrumentation,
etc.), will be printed on 11x17" landscape, multiple sheets. Printed symbol
size is more or less an industry standard which follows from visual and
readable. Number of sheets required to organize a printed presentation is
related to how much can fit on a sheet. How could I ensure all that, unless
the 100% view on the monitor, is the actual printed page size? For this,
zooming is mostly a design time process, because the monitor size is less
than the printed page.



For most applications, screen display and size for printing are entirely
separate issues, and I think that is how it should be.

The problem is that what is readable when printed with a good printer
may be too small to edit effectively on a normal screen. Similarly, the
largest drawing that can be viewed simultaneously by covering a table
with sheets of paper is far larger than most monitors.

The problem of letting people know what will fit on how many sheets is
solved e.g. in Microsoft Excel by having an option to show print page
boundaries on the display.

Patricia



Next Message: Drawing line on ImageIcon on panel after getting data


Blogs related to how to convert metric to pixels

computer vision software
ImageMagick - Load, display, process, save, and convert images in many formats. Works on Unix, Linux, Windows, and Mac. Includes a display program, a converter, screen capture, animator, and more. JPEG - Library source code and simple ...

how to........
how do i convert pixels into centimeters how to make a paint and its component how do i make a baseball cap out of fabric how to stop a narcissis how do i keep my car clean from my cats in the garage how do i tie a ribbon into a bow ...

[fm-news] Newsletter for Monday, September 17th 2007
RabbIT is written in Java and should be able to run on any platform. It does depend upon an image converter if image scaleing is on. The recommended image converter is "convert" from the ImageMagick package. ...

Meters
... ekg monitoring, neonatal, oximeters, oxygen, convert pixels to millimeters kinze brush meters time domain reflectometers metal tube rotameters+ansi ss316+range 10:1+accuracy +/-2% how many milimeters are in one centimeter hanging ...

Meters
160-80 meters coaxial loop antennas iarp parameters convert inches to centemeters rotavirus and rectal thermometers msiexec parameters forehead thermometers download geometers sketch pad older version proton precession magnetometers ...

Meters
... miles and kilometers used blade micrometers california convert pixels to millimeters haematological parameters in healthy adults rocketry altimeters birth asphyxia-parameters studied cheap galileo mini thermometers _hartslagmeters ...


Programming | Sports | Autos

copyright 2006
Valid XHTML 1.0 Transitional