unix4artists/processing/example-sketch/example-sketch.pde

46 lines
869 B
Plaintext

//Input should be .jpg or .png
String input = "";
String output = "";
PImage inputImage;
PGraphics canvas;
void setup() {
if (args != null) {
if (args.length > 0 && args[0] != null) {
input = args[0];
} else {
println("No input argument provided");
exit();
}
if (args.length > 1 && args[1] != null) {
output = args[1];
} else {
exit();
}
} else {
println("No arguments provided");
exit();
}
//don't show the processing window
surface.setVisible(false);
//only draw script once
noLoop();
//use psuedo-random generator
randomSeed(50);
}
void draw () {
inputImage = loadImage(input);
canvas = createGraphics(inputImage.width, inputImage.height);
canvas.image(inputImage, 0, 0);
/************************
* Do cool things here!!!
************************/
canvas.save(output);
exit();
}