Hello,
I am new to processing and I would like to use it to generate custom halftone effects using SVG files. I have managed to create something like this so far.
For my next step I am trying to figure out how to make different ranges of brightness values in the image use a different SVG but I can’t figure out how to do it.
This is my code so far:
PImage img;
PShape shape;
void setup() {
size (900,900);
img = loadImage("img.png");
img.resize(0,900);
shape = loadShape("shape1.svg");
}
void draw() {
background(#000000);
float tiles =90;
float tileSize =width/tiles;
translate(tileSize/2,tileSize/2);
for (int x = 0; x < tiles; x++) {
for (int y = 0; y < tiles; y++) {
color c = img.get(int(x*tileSize),int(y*tileSize));
float size = map(brightness(c),0,255,0,tileSize);
shape(shape,x*tileSize,y*tileSize,size,size);
}
}
}