# Processing Java Background Bug

**URL:** https://discourse.processing.org/t/processing-java-background-bug/46644
**Category:** Coding Questions
**Created:** [July 1, 2025, 8:26pm UTC](https://discourse.processing.org/t/processing-java-background-bug/46644 "2025-07-01T20:26:19Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)
#### Post date: [July 2, 2025, 12:09am UTC](https://discourse.processing.org/t/processing-java-background-bug/46644/2 "2025-07-02T00:09:50Z")

</div>

Hello @Bill_goo,

This works:

```auto
PImage bg;

void settings()
  { 
  println(pixelDensity); //What does this report?
  //pixelDensity(1); // Look this up.
    
  String urlString = "http://learningprocessing.com/code/assets/sunflower.jpg";
  bg = loadImage(urlString);
  
  if (bg == null) 
    {
    size(bg.width, bg.height);
    }
  else
    {
    println(bg.width, bg.height);
    size(bg.width, bg.height);
    }
  }

void setup()
  {
  }

void draw()
  {
  background(bg); // See reference
  }

```

Reference:

- [background() / Reference / Processing.org](https://processing.org/reference/background_.html)
- [pixelDensity() / Reference / Processing.org](https://processing.org/reference/pixelDensity_.html)

Try setting this and report back:  
`pixelDensity(1);`

It should have displayed as an image. Did it not?

`:)`

---

_[View the full topic](https://discourse.processing.org/t/processing-java-background-bug/46644)._
