Processing Java Background Bug

Hello @Bill_goo,

This works:

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:

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

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

:)

1 Like