Problems displaying images as background with pixeldensity

edited April 2016 in How To...

As you already know a background image must be the same size as your size canvas. The problem here is when I need to use pixelDensity(2), my background image scale down to half size. What should I do? Screen Shot 2016-04-07 at 10.59.58 AM

Answers

  • edited April 2016

    Have you tried to scale up your image to twice its original size before or after pixelDensity(2)?

    I don't have much experience with images, so it's just a suggestion.

  • The thing is that I need the image as background and I think a background is impossible to scale. If I scale the source image the size doesn't match and so I can't run the sketch.

  • Answer ✓

    Did you try it?

    PImage img;
    img = loadImage("0.jpg");
    size(400,400);
    img.width = width;
    img.height = height;
    background(img);
    
  • It works! You are a boss. Thank you.

Sign In or Register to comment.