topical media & game development
graphic-processing-site-examples-Libraries-Video--Capture--AsciiVideo-AsciiVideo.pde / pde
ASCII Video
by Ben Fry.
Text characters have been used to represent images since the earliest computers.
This sketch is a simple homage that re-interprets live video as ASCII text.
See the keyPressed function for more options, like changing the font size.
import processing.opengl.*;
import processing.video.*;
Capture video;
boolean cheatScreen;
// All ASCII characters, sorted according to their visual density
String letterOrder =
" .`-_':,;^=+/\"|)\\<>)iv\%xclrs{*}I?!][1taeo7zjLu" +
"nT#JCwfy325Fp6mqSghVd4EgXPGZbYkOA&8U
Handle key presses:
'c' toggles the cheat screen that shows the original image in the corner
'g' grabs an image and saves the frame to a tiff image
'f' and 'F' increase and decrease the font size
public void keyPressed() {
switch (key) {
case 'g': saveFrame(); break;
case 'c': cheatScreen = !cheatScreen; break;
case 'f': fontSize *= 1.1; break;
case 'F': fontSize *= 0.9; break;
}
}
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.