# Use pixel density to scale the sketch

**URL:** <https://discourse.processing.org/t/use-pixel-density-to-scale-the-sketch/15096>\
**Category:** Processing for Android\
**Created:** [November 1, 2019, 12:20am UTC](https://discourse.processing.org/t/use-pixel-density-to-scale-the-sketch/15096 "2019-11-01T00:20:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yash](https://avatars.discourse-cdn.com/v4/letter/y/f17d59/32.png) [@Yash](https://discourse.processing.org/u/Yash)\
**Post date:** [November 1, 2019, 12:20am UTC](https://discourse.processing.org/t/use-pixel-density-to-scale-the-sketch/15096/1 "2019-11-01T00:20:18Z")

</div>

How to use pixel density () method so i can scale my sketch irrespective of the device.(device dpi)?

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [November 1, 2019, 4:43am UTC](https://discourse.processing.org/t/use-pixel-density-to-scale-the-sketch/15096/2 "2019-11-01T04:43:52Z")

</div>

[https://android.processing.org/reference/environment/display.html](https://android.processing.org/reference/environment/display.html)

---

<div class="post-metadata">

**Author:** ![Yash](https://avatars.discourse-cdn.com/v4/letter/y/f17d59/32.png) [@Yash](https://discourse.processing.org/u/Yash)\
**Post date:** [November 1, 2019, 10:45am UTC](https://discourse.processing.org/t/use-pixel-density-to-scale-the-sketch/15096/3 "2019-11-01T10:45:03Z")

</div>

If i multiply the ellipses and fonts wont my collisions get disturbed?  
If i have ellipse of radius r which i had already implemented and written code for detecting collisions of those ellipses.  
Wont my code get faulty?

---

<div class="post-metadata">

**Author:** ![noel](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/noel/32/213_2.png) [@noel](https://discourse.processing.org/u/noel)\
**Post date:** [November 1, 2019, 11:21am UTC](https://discourse.processing.org/t/use-pixel-density-to-scale-the-sketch/15096/4 "2019-11-01T11:21:41Z")

</div>

It is a scaling factor. So I think when you are going to measure distance between center of ellipses you will have to apply the factor on the distance as well, I think you have to adapt your code.
