Vector Output
After some idle speculation about taking my last posted sketch further, I’ve been going back and forth with a boutique print site called Wall Blank about doing a run of prints. This may be as far as I take them, or it may just be the tip of the iceberg; but more on that later (whenever I figure it out).
The immediate challenge was outputting something usable in print. I saw two options; figure out a way to use a canvas thousands of pixels across for the sake of saving out a bitmapped screen grab as a file high-resolution enough to print, or, instead find a way to output as vector.
The latter is clearly the better option and it turns out Processing has a built in PDF library that does all the hard work for you. It’s not totally straightforward; you can’t just dump the screen contents to a file, instead you have to capture the entire draw loop from the start and save that out. But even that is fairly simple. My draw loop ended up something like this:
void draw() {
// setup the PDF save
if (writePDF) {
beginRecord(PDF, "frame-####.pdf");
};
// draw things here
// now that the draw buffer is full,
// dump the contents to a file
if (writePDF) {
endRecord();
writePDF = false;
};
};
The writePDF variable was an important check; without it I’d be writing PDFs on every frame. Instead I can toggle it on keypress and just capture a single frame:
void keyPressed() {
// if 'p' is pressed, save out a PDF
if (int(key) == 112) {
writePDF = true;
};
};
The resulting PDFs are surprisingly svelte; 8000 ellipses saved out to about files around 110k. My PNG screen grabs are usually at least 4 times as large.
What was particularly fun about this project is that I dared to ask whether each print could be unique, or if we were stuck working with the same source PDF for each print. I was pleasantly surprised to discover the printer was totally cool with printing a unique file for each one of the 100-print series, and happy to take advantage of that. With a slight modification to my draw loop:
void draw() {
if ((createStuff > 0) && (createStuff < 101)) {
beginRecord(PDF, "print-####.pdf");
};
if ((createStuff > 0) && (createStuff < 101)) {
endRecord();
createStuff++;
};
};
...all I had to do was hit a key and wait about a minute, and voila, 100 totally unique prints, but united as a series with a common palette.
I'll make sure to mention it again on here when the prints are available for purchase, probably closer to the end of August.
One Response to “Vector Output”
Leave a Reply




[...] prints produced a few days ago; they’ve now been added to WallBank. I wrote up the process in Vector Output, so go have a read if you’re curious about how I did [...]