Help with automating my program
in
Programming Questions
•
8 months ago
I am working on a project building off of the pointillism example. I am starting the point size at 100 and reducing it to 1 to get a clear image and at each different point size I am saving the pictures so I can assemble them later to show the overall product evolution. Here is a picture of one I have done already:
I showed this to my school art teacher and he thought it would be a good project to put in our areas art show/competition, but I need to use a photo of my own so this monkey one can't be used.
Currently I have the code set up so when I hit space it saves the frame, resets the background, and reduces the point size by one. The problem is that waiting for each picture to finish and pressing space for each picture takes a lot of time. I would like to add to the code so it can decide if it's done on its own. Like maybe by detecting if there was still pixels from the original background present. I'm not sure how to do this though. Here is my current code:
Currently I have the code set up so when I hit space it saves the frame, resets the background, and reduces the point size by one. The problem is that waiting for each picture to finish and pressing space for each picture takes a lot of time. I would like to add to the code so it can decide if it's done on its own. Like maybe by detecting if there was still pixels from the original background present. I'm not sure how to do this though. Here is my current code:
PImage BlueJelly;
void setup() {
size(2117, 1601);
BlueJelly = loadImage("BlueJelly.JPG");
imageMode(CENTER);
noStroke();
background(255);
pointsize = 100;
}
int pointsize;
void draw() {
display();
if (pointsize < 1) {
noLoop();
}
}
void display() {
int x = int(random(BlueJelly.width));
int y = int(random(BlueJelly.height));
color pic_color = BlueJelly.get(x, y);
fill(pic_color, 128);
ellipse(x, y, pointsize, pointsize);
}
void keyPressed() {
if (key == ' ') {
saveFrame("PixBlueJelly"+pointsize+".JPG");
background(255);
pointsize -= 1;
}
}
The "BlueJelly" is referring to a jelly fish picture.
Any help or suggestions on this would be greatly appreciated!
Thanks!
Any help or suggestions on this would be greatly appreciated!
Thanks!
1