Pixel to Centimeter?

前端 未结 9 1610
忘了有多久
忘了有多久 2020-11-29 02:35

I just want to know if the pixel unit is something that doesn\'t change, and if we can convert from pixels to let\'s say centimeters ?

9条回答
  •  日久生厌
    2020-11-29 03:10

    I'm going to go out on a limb and just guess that you want to be able to display things to the user on their monitor, scaled to be very close to its real life size.

    IF this is the case, I would recommend either displaying your items next to real life items (credit cards, dollar bills, pop cans, etc) or even better, allow the user to hold something up to the screen like a credit card or dollar bill or ruler. You could then have them scale a slider or something similar to meet the width or height of that object.

    By holding a credit card, something with a relatively known height and width, up to the screen, you can easily determine the ratio of pixels to inches and use that to your hearts content.

    Wiki says

    Most credit cards are issued by local banks or credit unions, and are the shape and size specified by the ISO/IEC 7810 standard as ID-1 (85.60 × 53.98 mm)

    Using mspaint, a credit card of mine is exactly 212 pixels tall, thats 53.98mm / 212 pixels = 3.92 pixels per mm. Multiply by 10 and that's 39.2 pixels per cm.

    You could EASILY do that programatically via javascript, C#, flash, whatever you want.

提交回复
热议问题