# Set Height and Width of Display Area using Variables?

**URL:** <https://discourse.processing.org/t/set-height-and-width-of-display-area-using-variables/38468>\
**Category:** Beginners\
**Created:** [August 23, 2022, 8:12pm UTC](https://discourse.processing.org/t/set-height-and-width-of-display-area-using-variables/38468 "2022-08-23T20:12:59Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![digitalArtform](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@digitalArtform](https://discourse.processing.org/u/digitalArtform)\
**Post date:** [August 23, 2022, 8:12pm UTC](https://discourse.processing.org/t/set-height-and-width-of-display-area-using-variables/38468/1 "2022-08-23T20:12:59Z")

</div>

Is it possible to first load an image, and then use the height and width of the loaded image to specify the height and width of the Processing canvas? Every example I see already knows the needed canvas height and width in advance and sets it using known integers in the size() command.

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [August 23, 2022, 8:14pm UTC](https://discourse.processing.org/t/set-height-and-width-of-display-area-using-variables/38468/2 "2022-08-23T20:14:42Z")

</div>

> **[Reference](https://processing.org/reference/settings_.html)**
>
> The settings() function is new with Processing 3.0. It's not needed in most sketches. It's only useful when it's absolutely necessary to define the parameters to size() with a variable. …
