Trying to fill a shape with a pixel colour from a loaded image

The Coidng Train on youtube has a processing pixels playlist, it could help you.
Edit: https://www.youtube.com/watch?v=EmtU0eloTlE&list=PLRqwX-V7Uu6YB9x6f23CBftiyx0u_5sO9&index=4
Also: get() / Reference / Processing.org
Another edit: this simple code works:

PImage img;
//the images width and height is 640
int e = int(random(0, 641));
int e2 = int(random(0, 641));


void setup() {
  size(640, 640);
  img = loadImage("blabla.png");
}

void draw() {
  color c = img.get(e, e2);
  fill(c);
  rect(0, 0, 100, 100);
}