Get() Problems - Pro3 - Fr/Eng

Hello ! I’m new to processing and I need your help :slight_smile:

I need to select pixel’s area from my original image and to transpose it in rectangles.
I learned that -get()( could help me but I do not know where to place it in my code :

PImage photo;
int posX = int(random(0,1920));
int posY = int(random(0,1080));
int sizeH = int(random(0,400));
int sizeL = int(random(0,400));

void setup() {
size(1000,600);
photo = loadImage(“Photo.jpg”);

}
void draw(){
background(0,0,0);
image(photo,0,0,1920,1080);

}


The source for -get()- : https://www.processing.org/reference/get_.html

thanksyou !!

Hello and welcome to the forum!

Nice to have you here!

Yeah, you can select an area and copy it to a new image

PImage pi = get(30,30,100,100);

then you can make a nested for-loop over pi and use col1=get(x,y); to get the color of one color pixel

Then you can use fill(col1); rect(....); to enlarge pi. Just multiply x,y to get a grid of bigger rectangles.

Warm regards,

Chrisir

OOoh thanks you so much ! :slight_smile:

Can I enlarge pi with random number ?

Warm regards,

Elio

of course

PImage pi = get(30,30,random(40,200),random(40,200));

see get() / Reference / Processing.org

OK well, Thank you very much :slight_smile:

1 Like