|
Author |
Topic: saving previews (Read 387 times) |
|
kevinP
|
saving previews
« on: Feb 21st, 2004, 3:04pm » |
|
Benelek wrote once: hey u know, i wouldn't mind having an easy (easier?) way to just get regular printscreens for project documentation, and such. they could be labelled according to date and time and put in the sketch folder, as u suggested. I was just looking through the archive with the thought in mind that it would be nice to be able to automatically save previews of various sketches. save() gets me pretty close, but it saves into the root processing directory (why?). Is there a way win Java that I can retrieve the name of the sketch that is running? Then I can save these previews with the name of the sketch. It might actually be nice to have this as an added processing function: thumbnail() - or preview() that one could drop into the code, which would grab current frame and write it to the current sketch folder (or a general previews folder)? (when running in an applet it would benignly do nothing)
|
« Last Edit: Feb 21st, 2004, 4:45pm by kevinP » |
|
Kevin Pfeiffer
|
|
|
fry
|
Re: saving previews
« Reply #1 on: Feb 21st, 2004, 7:55pm » |
|
as part of that big release (69 or 70 or so), save() will properly put things in the folder of the sketch, rather than the p5 folder, so that'll be solved. as for getting the name of the sketch, if you're running in java mode (as in, you have a "public class SketchName extends BApplet" at the beginning of your program, you can get the sketch name (really the class name) by using: String name = getClass().getName(); if not in java mode, this will return "Temporary_2348_8873" or something like that. as for making thumbnails/previews, this can be done with a very short set of statements: // copy makes a copy of a BImage, and BGraphics is a BImage BImage lilfella = copy(previewWidth, previewHeight); lilfella.save("sketchname.tif"); alternatively you could easily add a timestamp using day() / month() functions.
|
|
|
|
|