# Show image in setup

**URL:** https://discourse.processing.org/t/show-image-in-setup/4347
**Category:** Coding Questions
**Created:** [October 10, 2018, 11:31pm UTC](https://discourse.processing.org/t/show-image-in-setup/4347 "2018-10-10T23:31:21Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![FerrariLuigi](https://avatars.discourse-cdn.com/v4/letter/f/5f8ce5/32.png) [@FerrariLuigi](https://discourse.processing.org/u/FerrariLuigi)
#### Post date: [October 10, 2018, 11:31pm UTC](https://discourse.processing.org/t/show-image-in-setup/4347/1 "2018-10-10T23:31:21Z")

</div>

Dear all,  
I wrote a processing sketch that has a very long setup function. During setup I have to read many files and I have to initialize a large number of varabiles.  
Unfortunately during setup the screen is complitely black and it is not so good.  
Can I display an image in the setup function ?

Thank you very much for your help and cooperation  
regards

---

<div class="post-metadata">

### Author: ![Sarah](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/sarah/32/1675_2.png) [@Sarah](https://discourse.processing.org/u/Sarah)
#### Post date: [October 10, 2018, 11:42pm UTC](https://discourse.processing.org/t/show-image-in-setup/4347/2 "2018-10-10T23:42:06Z")

</div>

Unfortunately, the screen only started rendering after `void draw` starts.

Luckily, you can easily put your setup code in a function, and run it during the start of draw. Eg.

```auto
String scene = "setup";

void setup() {
  size(...);
}

void draw() {
  switch(scene) {
  case "setup":
    ...Display stuff here...
    setupSketch();
    scene = "loaded";
    break;
  case "loaded":
    ...Your code here...
    break;
  }
}

void setupSketch() {
  ...Your setup code here...
}

```

---

<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: [October 11, 2018, 12:57am UTC](https://discourse.processing.org/t/show-image-in-setup/4347/3 "2018-10-11T00:57:02Z")

</div>

[Processing.org/reference/requestImage\_.html](http://Processing.org/reference/requestImage_.html)

---

<div class="post-metadata">

### Author: ![FerrariLuigi](https://avatars.discourse-cdn.com/v4/letter/f/5f8ce5/32.png) [@FerrariLuigi](https://discourse.processing.org/u/FerrariLuigi)
#### Post date: [October 12, 2018, 5:35pm UTC](https://discourse.processing.org/t/show-image-in-setup/4347/4 "2018-10-12T17:35:27Z")

</div>

Thank you! 🤩  
regards.
