Calculate inches and centimeters from pixels in C#

前端 未结 1 1386
栀梦
栀梦 2021-01-14 10:29

I am working on a Productivity app and need to be able to calculate (in C#) inches and centimeters. Based on pixels, obviously.

When you open Microsoft Word, and sea

相关标签:
1条回答
  • 2021-01-14 11:00

    I think the conversion of pixels to centimeters depends on the DPI (dots per inch) of the media which is displaying the image.

    Also the formula is simple for conversion ie,

    points = pixels * 72 / 96
    

    since there 72 points per inch and 96 pixels per inch(you can assume)

    You may also check How do you convert pixels into centimeters?

    In truth, you don't convert pixels to cm. There is a little more information that is needed and without knowing exactly what it is that you want to do, it is difficult to address this completely. There is a de facto norm of 300 DPI /PPI for printing (that is 300 / 2.54 pixels/cm).

    A pixel is one of the colored dots on your computer screen that makes up both images and text (as well as all of the blank areas in between them). Most computer screens display either 72 or 96 pixels per inch. Most printing is based on 300 pixels per inch (rarely 240 PPI).

    If you are asking about printing: If you want to make a 4 x 6 inch print on a 300 DPI (Dot Per Inch) printer you need your file to contain 1200 x 1800 pixels. An 8 x10 printout will have to be 2400 x 3000 pixels. In reality, most consumer printing systems will handle this conversion for you. You just tell the software what size print you want to make the software will "re size" your image to the correct dimensions.

    0 讨论(0)
提交回复
热议问题