Hi!
Firstly please excuse my newbie question! Could anyone point me in the right direction please? I am trying to source a random pixel colour from a loaded image and load it in to a shape. I have spent a few hours looking through the forums but have not found anything so far.
Thanks in advance,
Jess
PImage img;
float pointillize = 100;
PShape svg;
float my_num = 0;
void setup() {
size(900,900);
svg = loadShape("Virus_organic.svg");
img = loadImage("Snake.jpg");
background(255);
smooth();
}
void draw() {
img.resize(900,900);
float x = noise(my_num) * width;
float y = noise (my_num + 40) * height;
float loc = x + y*img.width;
my_num = my_num + 0.02;
//here I am trying to locate a random pixel colour from my loaded image
//loadPixels();
//float r = red(img.pixels[loc]);
//float g = green(img.pixels[loc]);
//float b = blue(img.pixels[loc]);
//noStroke();
shape(svg, x, y, pointillize, pointillize);
shapeMode(CENTER);
svg.disableStyle();
//here I am trying to fill my shape with the random pixel colour from my loaded image
//fill(r,g,b,100);
}