Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
processing png
<!DOCTYPE html>
<title>processing png</title>
<script src=""></script>
<script src=""></script>
<canvas width="0" height="0"></canvas> (Canvas)
<img class="png" /> &lt;- Save or drag and drop this image as a file.
<form class="preview" action="javascript:void(0);">
<textarea rows="12" cols="60">
void setup() {
int m = 4; // mergin
int s = 16; // size
size(s, s);
// smooth(); // This can have meaning with orignal Java implementation of Processing
line(m, m, s - m, s - m);
line(s - m, m, m, s - m);
<input type="submit" value="update" />
function updateCanvasAndImg () {
var canvas = $("canvas")[0];
new Processing(canvas, $("textarea")[0].value);
$("img.png").attr("src", canvas.toDataURL());
$("form").live("submit", updateCanvasAndImg);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.