# Use of inches in the Canvas

**URL:** <https://discourse.processing.org/t/use-of-inches-in-the-canvas/22733>\
**Category:** Project Guidance\
**Created:** [July 19, 2020, 7:17pm UTC](https://discourse.processing.org/t/use-of-inches-in-the-canvas/22733 "2020-07-19T19:17:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![edduda1](https://avatars.discourse-cdn.com/v4/letter/e/0ea827/32.png) [@edduda1](https://discourse.processing.org/u/edduda1)\
**Post date:** [July 19, 2020, 7:17pm UTC](https://discourse.processing.org/t/use-of-inches-in-the-canvas/22733/1 "2020-07-19T19:17:28Z")

</div>

Hello,

I working on a project to simulate an arm swinging (ex. pendulum) but want to se the actual dimensions of an arm. For example 27 inches in length. How can I actually get the length when the canvas is in pixels?

Thanks…

---

<div class="post-metadata">

**Author:** ![jb4x](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jb4x/32/789_2.png) [@jb4x](https://discourse.processing.org/u/jb4x)\
**Post date:** [July 19, 2020, 8:43pm UTC](https://discourse.processing.org/t/use-of-inches-in-the-canvas/22733/2 "2020-07-19T20:43:55Z")

</div>

Hello,

For this, you will need to know the real world dimension of your screen (the display area) and its resolution (Number of pixels for the width and height).

Based on those informations, you can get the real world size of a pixel and use that to draw what you want based on the real world size.

Of course you will need to calculate those values every time you are changing your screen.

If you want to automate it with code, you can have a look at this: [https://docs.oracle.com/javase/6/docs/api/java/awt/Toolkit.html#getScreenResolution()](https://docs.oracle.com/javase/6/docs/api/java/awt/Toolkit.html#getScreenResolution())

---

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [July 20, 2020, 10:30am UTC](https://discourse.processing.org/t/use-of-inches-in-the-canvas/22733/3 "2020-07-20T10:30:46Z")

</div>

Hello,

Wikipedia reference:

> **[Pixel density](https://en.wikipedia.org/wiki/Pixel_density)**
>
> Pixels per inch (ppi) and pixels per centimetre (ppcm or pixels/cm) are measurements of the pixel density (resolution) of an electronic image device, such as a computer monitor or television display, or image digitizing device such as a camera or image scanner. Horizontal and vertical density are usually the same, as most devices have square pixels, but differ on devices that have non-square pixels.
> Pixels per inch (or pixels per centimetre) can also describe the resolution, in pixels, of an ima...

You may also want to confirm your display measurements (measure) against the specs of your display.

`:)`
