Apply color filter to PGraphics

Help!! I need to assign at least two colors to the “walker” class. Try to draw a PGraphics in grayscale to then assign the colors but I do not know how to continue.
How do I draw 2 PGraphics to then assign different color palettes?

PGraphics pg;
ArrayList <Caminante> caminantes;

Paleta colores;
PImage pincelada, arch;
int posx, posy;
int cantidad = 10;
void setup() {

  pg = createGraphics (100, 100); 

    size( 600, 600 );
  
colores= new Paleta ("imagen_5.jpg");
    caminantes = new ArrayList();
  for ( int i=0; i<cantidad; i++ ) {
    Caminante c = new Caminante(colores.devolverColor());
    caminantes.add( c );
  }
}
void draw() {
  pg.beginDraw();
  pg.imageMode(CENTER);
  pg.colorMode(HSB, 100);
  
  
  
  
  pg.endDraw();
for ( Caminante este : caminantes ) {
    if( mousePressed ){
      pushStyle();
      fill( 0 , 30 );
      rect( 0,0, width ,height );
      popStyle();
    }    
    este.mover();
    este.dibujar();          
  }
}
class Caminante {
  float x,y;
  float t;
  float velocidad;
  float direccion;
  float variacionAngular = 7;
  color colorRelleno;
  PImage pincel;
  
   Caminante(color _colorRelleno ) {
    colorRelleno = _colorRelleno;
    if (random(100) < 50)
    {
      x = width;
      y = random( height );
    }
    else
    {
      x = random( width );
      y = height;
    }
    
    t = random( 10,20 );
    velocidad = 2;
    direccion = 10;//radians( random(100) );
    pushStyle();
    print("caminantes");
    popStyle();
  }
  
  void dibujar(){
    imageMode(CENTER);
    pincel = loadImage ("pincel1.png");
    pushStyle();
    tint(colorRelleno, 80);

    
    loadPixels();
for (int i = 0; i < width*height; i++) {
color p = pixels[i]; // Guardar color de pixel
float r = red(p); // Modificar valor de color
float g = green(p); //Modificar valor de color
float b = blue(p); // Modificar valor de color
float bw = (r + g + b) / 3.0;
pixels[i] = color(bw); // Asignar valor modificado por mouseX
}
updatePixels();
    image(pincel, x, y);
    popStyle();
  }
  
  void mover(){
     direccion = direccion + radians( random(-variacionAngular,variacionAngular) );
    float dx = velocidad * cos( direccion );
    float dy = velocidad * sin( direccion );
    x = x + dx;
    y = y + dy;
   
    x = ( x>width-10 ? x-width : x );
    x = ( x<0 ? x+width : x );
    y = ( y>height ? y-height : y );
    y = ( y<0 ? y+height : y );
  } 
}
class Paleta {
PImage cuadro;  

  Paleta (String nombreArchivo ) {
    cuadro=loadImage (nombreArchivo );
    print("Entro");
  }
  void dibujar(int x_, int y_) {
    int posx=x_;
    int posy=y_;
    image (cuadro, posx, posy);
    print("dibujar");
  }
  color devolverColor() {

    int x = int( random( cuadro.width ) );   
    int y = int(random( cuadro.height ));   
    print("devolvio");
    return cuadro.get( x, y );
  }
}

I’m not sure what you mean / why you are trying to do this. Why not just give each walker its own PGraphics, if each one should contain a different colored image?

Can you explain your goal more? Is this like wanting to have two sprites in two class objects – like a “Mario” and “Luigi” (Mario Bros.)?