Posted By

Kobby on 03/07/12


Tagged

basic image output Processing saving sketch experimentation protoyping


Versions (?)

Basic Processing Sketch for Image making/experimentation


 / Published in: Processing
 

This is an slightly more involved processing basic sketch I use when creating Imagery so I can save and output images at any point in time when the sketch is running.

  1. import processing.pdf.*;
  2.  
  3. boolean isMakingPdf = false;
  4.  
  5. void setup(){
  6. }
  7.  
  8. void draw(){
  9. if(isMakingPdf){
  10. beginRecord(PDF, "frame-####.pdf");
  11. }
  12.  
  13. //draw stuff
  14.  
  15. if(isMakingPdf){
  16. endRecord();
  17. isMakingPdf = false;// stop pdf creation after the frame ends
  18. }
  19. }
  20.  
  21. void keyPressed(){
  22. //save PDF when you hit the o key
  23. if(key == 'o'){
  24. isMakingPdf = true;
  25. }
  26.  
  27. //save jpg image when you hit the s key
  28. if(key == 's'){
  29. saveFrame("frame-####.jpg");
  30. }
  31. }

Report this snippet  

You need to login to post a comment.