Hi, for my first topic I’m sharing what I have been up to today.
I spent a bit of time today making a weird tool to “pixelate” images, for now it as a bunch of is statements with preset brush sizes, but I intend change that so pixel size and spacing to be controlled more precisely and independently of one another.
After that I may start thinking of adding more shapes ( triangles , circles ) instead of just squares.
Code
PImage img;
int Image = width*height;
int pixel;
int brush_setup;
int X, Y;
void setup() {
img = loadImage("test.png");
size(512, 512);
image(img, 0, 0);
brush_setup = 1;
noStroke();
println("Brush Setup: ", brush_setup);
}
void draw() {
pixel = get(mouseX, mouseY);
fill(pixel);
}
void mouseDragged() {
brush_change();
}
void keyPressed() {
if (key == 'b' || key == 'B') {
brush_setup = brush_setup + 1;
println("Brush Setup: ", brush_setup);
}
if (key == 'r' || key == 'R') {
image(img, 0, 0);
println("Reseted!");
}
}
void brush_change() {
if (brush_setup == 1) {
X = mouseX - (mouseX % 7);
Y = mouseY - (mouseY % 7);
rect(X, Y, 5, 5);
}
if (brush_setup == 2) {
X = mouseX - (mouseX % 13);
Y = mouseY - (mouseY % 13);
rect(X, Y, 10, 10);
}
if (brush_setup == 3) {
X = mouseX - (mouseX % 19);
Y = mouseY - (mouseY % 19);
rect(X, Y, 15, 15);
}
if (brush_setup == 4) {
X = mouseX - (mouseX % 25);
Y = mouseY - (mouseY % 25);
rect(X, Y, 20, 20);
}
if (brush_setup == 5) {
X = mouseX - (mouseX % 51);
Y = mouseY - (mouseY % 11);
rect(X, Y, 50, 10);
}
if (brush_setup == 6) {
X = mouseX - (mouseX % 6);
Y = mouseY - (mouseY % 76);
rect(X, Y, 5, 75);
}
if (brush_setup == 7) {
brush_setup = 1;
println("Brush Setup: ", brush_setup);
}
}