[Processing] PImage JavaScript

PImage img = loadImage("mito.jpg"); //here img is a variable
//size(1500, 1500); // dimension of my image
size(640, 480);
image(img, 0, 0, 640, 480); // (img, xpos, ypos, width, height)

*

PImage bg, rabbit;

void setup(){
 
  size(640, 360);
  bg = loadImage("moonwalk.jpg");
  rabbit = loadImage("rabbit3.png");
  rabbit.resize(0, 150); //resize rabbit image
  imageMode(CENTER); // otherwise rabbit goes to too right side
  rectMode(CENTER);
  noStroke();
}

void draw(){
  
  //background(bg);
  //image(rabbit, mouseX, 180);
  fill(bg.get(mouseX, mouseY));
  rect(mouseX, mouseY, 30, 30);
  
}

*
PImage bg;

void setup() {

  size(640, 360);
  bg = loadImage("moonwalk.jpg");
  rectMode(CENTER);
  noStroke();
}

void draw() {
  int x = int(random(bg. width));//for pixel there is no other than integer /no number with point
  int y= int(random(bg. height));
  color c = bg.get(x,y);
  fill(red(c), 0, 0, 120); // print only red channel because of (r).g.b order 
  ellipse(x, y, 30, 30);
}

*

PImage bg;

void setup() {

  size(640, 360);
  bg = loadImage("moonwalk.jpg");
  rectMode(CENTER);
  noStroke();
}

void draw() {
  int x = int(random(bg. width));//for pixel there is no other than integer /no number with point
  int y= int(random(bg. height));
  color c = bg.get(x,y);
  float size = map(mouseX, 0, width, 0, 255);
  fill(red(c), 0, 0, 120); // print only red channel because of (r).g.b order 
  ellipse(x, y, size, size);
}