# Background Image won't load

**URL:** https://discourse.processing.org/t/background-image-wont-load/15964
**Category:** Coding Questions
**Created:** [November 30, 2019, 2:06am UTC](https://discourse.processing.org/t/background-image-wont-load/15964 "2019-11-30T02:06:59Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![thegoodnunes](https://avatars.discourse-cdn.com/v4/letter/t/74df32/32.png) [@thegoodnunes](https://discourse.processing.org/u/thegoodnunes)
#### Post date: [November 30, 2019, 2:06am UTC](https://discourse.processing.org/t/background-image-wont-load/15964/1 "2019-11-30T02:06:59Z")

</div>

Hi All-  
I’m attempting to get this fork process, to run over the top of a background image, instead of the default neutral single color. I’ve loaded the image into the sketch data file, and attempted to set it up and draw it, but I just can’t figure out how to connect the dots so that the image displays in the background while the code runs its color process in the foreground. I keep getting a “bg is not defined” error in the log.  
[https://www.openprocessing.org/sketch/802011](https://www.openprocessing.org/sketch/802011)

---

<div class="post-metadata">

### Author: ![kll](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/kll/32/964_2.png) [@kll](https://discourse.processing.org/u/kll)
#### Post date: [November 30, 2019, 3:47am UTC](https://discourse.processing.org/t/background-image-wont-load/15964/2 "2019-11-30T03:47:48Z")

</div>

with this reduced code:

```auto
PImage bg;

void setup() {
  size(1200, 600);
  bg = loadImage("BayBridgeSunset_1200x600.png");
}

void draw() {
  image(bg,0,0);
  if ( frameCount%60 == 0 ) println(nf(frameRate,0,1));
}

```

it work, but need about 4 sec to load here.  
the FPS i see about 35.

* * *

the

```auto
	background(bg);

```

only ends in error.

---

<div class="post-metadata">

### Author: ![Lexyth](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/lexyth/32/7403_2.png) [@Lexyth](https://discourse.processing.org/u/Lexyth)
#### Post date: [November 30, 2019, 8:55pm UTC](https://discourse.processing.org/t/background-image-wont-load/15964/3 "2019-11-30T20:55:00Z")

</div>

You’re using :

```auto
PImage = bg;

```

but that‘s not a correct way to define a variable…  
Instead use :

```auto
PImage bg;

```
