# Declare variable for PGraphics which is given image as an input

**URL:** <https://discourse.processing.org/t/declare-variable-for-pgraphics-which-is-given-image-as-an-input/12473>\
**Category:** Coding Questions\
**Created:** [July 3, 2019, 12:57pm UTC](https://discourse.processing.org/t/declare-variable-for-pgraphics-which-is-given-image-as-an-input/12473 "2019-07-03T12:57:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ruchi](https://avatars.discourse-cdn.com/v4/letter/r/f475e1/32.png) [@Ruchi](https://discourse.processing.org/u/Ruchi)\
**Post date:** [July 3, 2019, 12:57pm UTC](https://discourse.processing.org/t/declare-variable-for-pgraphics-which-is-given-image-as-an-input/12473/1 "2019-07-03T12:57:40Z")

</div>

Hi. I am loading an image in PGraphics sketch. Taking the color of each pixel and drawing rotated rectangles on main Sketch with the colors of each pixel from image.

My confusion is  
how do I define PGraphics variables.  
Do I need to make another class or wrapper class?  
What exactly is a wrapper class?

---

<div class="post-metadata">

**Author:** ![kfrajer](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kfrajer/32/196_2.png) [@kfrajer](https://discourse.processing.org/u/kfrajer)\
**Post date:** [July 3, 2019, 5:08pm UTC](https://discourse.processing.org/t/declare-variable-for-pgraphics-which-is-given-image-as-an-input/12473/2 "2019-07-03T17:08:06Z")

</div>

You can create a PImage to store your current sketch content:

`PImage temporalImage = get();`

More [here](https://processing.org/reference/PImage.html). Additioanlly, you can use a PGraphics using [createGraphics()](https://processing.org/reference/createGraphics_.html). Try any of them and if you have any other question, please provide some code.

Kf

---

<div class="post-metadata">

**Author:** ![Ruchi](https://avatars.discourse-cdn.com/v4/letter/r/f475e1/32.png) [@Ruchi](https://discourse.processing.org/u/Ruchi)\
**Post date:** [July 5, 2019, 2:30pm UTC](https://discourse.processing.org/t/declare-variable-for-pgraphics-which-is-given-image-as-an-input/12473/3 "2019-07-05T14:30:47Z")

</div>

I complicated it. It worked fine with pgraphics .Thanks.
