File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes General Computing and the fly likes Relation between pixel,cm,mm Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » General Computing
Bookmark "Relation between pixel,cm,mm" Watch "Relation between pixel,cm,mm" New topic

Relation between pixel,cm,mm

Balaji Loganathan
author and deputy

Joined: Jul 13, 2001
Posts: 3150
Can anyone tell the relation between pixel,cm,mm
1cm = 10mm
2.54cm = 1 inch
1 pixel = ?cm or ?mm
I need this info for html table width and height.

Spritle Software Blogs
Frank Carver

Joined: Jan 07, 1999
Posts: 6920
The missing information you need is the pixel size, typically expressed as dpi (dots per inch).
For most display screens (CRT/TFT etc), there seems to be a default assumption of 75dpi. For other devices there is no default, it depends on the device (e.g. HP printers are often 300, 600 or 1200 dpi etc., Epson printers are often 720, 1440, 2880 dpi etc.)
In your software you can't ever specify how large something on the screen is in real-world units. You can't know in advance what size the user's screen is and what resolution they have it set to.

Read about me at ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Balaji Loganathan
author and deputy

Joined: Jul 13, 2001
Posts: 3150
Thanks Frank!..
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4351

the vast majority of people have their resolution set at 800X600 and the browser window maximum size. the browser frame and scroll bar take up a little of that. so a width of just under 800 will fill the screen(however big it is) considering the fact that some have a higher resolution setting, i often set my table width to 100% that way things spread out instead of having a blank area on the right side. usually you will want a combination of relative and absolute widths. even if your table is not intended to fill the whole width, you can use relative instead of absolute. for example with width=50% the table will use half the width of the window no matter what the resolution or screen size is. hope that helps some.

Visit my download page
Jim Yingst

Joined: Jan 30, 2000
Posts: 18671
the vast majority of people have their resolution set at 800X600 and the browser window maximum size.
I've never really looked at statistics on this, but it seems to me as though the vast majority of people have resolution above 800x600. I'd assume 800x600 is the minimum size you can be expected to design for - but realize it will vary a lot from user to user.

"I'm not back." - Bill Harding, Twister
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

Amusingly, the inch is officially defined these days in metric terms. That is, one inch is EXACTLY 2.54cm.
Nominal screen pixel size is 72/inch. If you want more precision, consider that monitor specs are freqently advertised at around .28.
Where EXACT physical screen size is important, applications usually request calibrations. For example, The Gimp pulls info from the windowing system, and also allows you to type in the actual measurements you get by holding a ruler up to your screen and telling it what size displayed reference lines are.
My guidelines are that stand-alone applications should (with rare expections) be runnable on a 640x480 display and web apps should be usable in an 800x600. Probably most people can do at least 1024x768 these days, but why force them?
It's almost impossible to force the physical sizes in an html table. If you're looking to generate a report and want to ensure that the tables come out properly, you're better off generating a PDF.
Even discounting the peculiar problems of HTML, a general-purpose program should be tested at multiple resolutions - the text fields often actually take up MORE space on a higher-resolution display under MS-Windows!

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Relation between pixel,cm,mm
jQuery in Action, 3rd edition