Recent

Author Topic: convert pixels to centimeters  (Read 6589 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
convert pixels to centimeters
« on: July 24, 2012, 05:21:01 pm »
How do I calculate the ratio between pixels and inches? I managed to create a program that works with pixels, but now my client says I have work to centimeters. How can I do?!
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

KpjComp

  • Hero Member
  • *****
  • Posts: 680
Re: convert pixels to centimeters
« Reply #1 on: July 24, 2012, 05:28:15 pm »
There is a screen.pixelsperinch.

But been asked to work in inches for a program your creating sounds like and odd request.

Blestan

  • Sr. Member
  • ****
  • Posts: 461
Re: convert pixels to centimeters
« Reply #2 on: July 24, 2012, 06:21:33 pm »
pixels  / pixels_per_inches  (72 or 96 ) * 2.54 = cm
Speak postscript or die!
Translate to pdf and live!

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12182
  • FPC developer.
Re: convert pixels to centimeters
« Reply #3 on: August 15, 2012, 09:23:52 pm »
Pixels what? Pixels on screens, camera images, scanners ?

Note that not all sources (specially cameras!) don't have the same DPI in the X and Y direction.

ToBr

  • New Member
  • *
  • Posts: 15
Re: convert pixels to centimeters
« Reply #4 on: August 19, 2012, 07:02:58 pm »
Pixels/inch mostly depends on the hardware used.
For a  TV screen you can divide the number of the horizontal lines (e.g. 1080 for HD) by the vertical dimension of the screen in inches.
For a inkyet printer: see the documentation. (up to 1200 dpi).
For a .jpg file to print are required 300 dpi.
The dpi of a .jpg file determines the quality.
Terms Dots and pixels are misused.
Both total number of pixels and pixels per inch are used for quality.
Ask what is required. ppi or total pixels hor and vert
TB

ToBr

  • New Member
  • *
  • Posts: 15
Re: convert pixels to centimeters
« Reply #5 on: August 19, 2012, 07:11:46 pm »
Pixels what? Pixels on screens, camera images, scanners ?

Note that not all sources (specially cameras!) don't have the same DPI in the X and Y direction.

As far as I know each digital camera has the same dpi in each direction.
The total number of pixels differ, mostly in a ratio of 2:3 or 3:4.
This relates to the dimensions of the printing paper / monitor dimension / old TV screen.
AB

 

TinyPortal © 2005-2018