PImage.resize problem

ch3ch3
edited December 2015 in JavaScript Mode

in javaScript mode of processing 2.2.1, the resize function breaks my sketch.

    /* @pjs preload="../georgios.jpg"; */
PImage img;

void setup() {
  //size(800,800, RGB);
  size(800,800, P2D);
  colorMode(RGB,1);
  background(0);
  //frameRate(60);
  img = loadImage("../georgios.jpg");
  img.resize(100, 100);
}

void draw() {
  background(0);
  image(img, 0, 0);
}

Strange thing is that if I comment out the framerate it displays the image but at the original size.

there has been another post about this, but no answer. Any ideas maybe? Thank you

Answers

  • edited December 2015 Answer ✓

    This path is strange: "../georgios.jpg".
    Can you try out change file location to "georgios.jpg" instead?

  • oh that actually fixed it.

    That was actually a side question I wanted to ask. I ended up having it at the parent directory because every time I save/export the sketch, processing will wipe out the jpg from the web-export directory. Is there a way to copy all the media files I need into that directory, on every export? What's the common practice?

    thanks for pointing that out

  • In general, Processing expects our files to be in "data/" subfolder.
    I thought "JavaScript Mode" would copy anything there to "web-export", wouldn't it? :-/

  • oh right, yes it does!

    Thanks a lot

Sign In or Register to comment.