Listing Pixel Array
in
Programming Questions
•
2 years ago
Hello Processing forum,
Im quite new to processing and I've been banging my head on this.
Here is a simplified version of this neat piece of code here
http://www.openprocessing.org/visuals/?visualID=31404
I would like to simplify the output image into a less dense amount of circle, but that would still somehow describe the picture. Like a pixelating effect. So I guess I have to jump in the array, say, every 10 pixels, pick one, and feed its value to the circle.
Thanks in advance.
PImage img;
int i;
float im, imax, imin;
float x, y;
float smod = 0.20; // size modifier
void setup() {
img = loadImage("Sans titre.jpg");
size(img.width, img.height);
imax = img.width * img.height;
imin = 0;
smooth();
}
void draw() {
im += 200; // I am not so sure about how this affect the code
if (im > imax) im = imax;
for (i = int(imin); i < im; i++) {
x = (i)%(img.width); // these are the two linesI was tweaking
y = floor((i)/(img.width));
color cc = img.pixels[i];
float sat = saturation(img.pixels[i]);
fill(cc);
stroke(cc);
strokeWeight(sat*(smod/30));
ellipse(x, y, sat*(smod/2) , sat*(smod/2));
}
imin = im;
}
1