Skip to content

Instantly share code, notes, and snippets.

@yumu19
Last active August 29, 2015 14:14
Show Gist options
  • Save yumu19/d25b9da057d52cc72383 to your computer and use it in GitHub Desktop.
Save yumu19/d25b9da057d52cc72383 to your computer and use it in GitHub Desktop.
Save Camera Image
import processing.video.*;
Capture cam;
PImage img;
String path;
String command;
int i;
void setup(){
size(640,384);
cam = new Capture(this, width, height, 10);
cam.start();
img = new PImage(width,height);
i = 0;
}
void draw() {
path = "/Users/yumu/Desktop/img/img"+str(i)+".png";
command = "/usr/bin/osascript -e \'tell application \"Finder\" to set desktop picture to POSIX file \""+path+"\"\'";
image(cam,0,0);
save(path);
i++;
}
void captureEvent(Capture camera) {
camera.read();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment