Name |
saveFrame()保存序列帧 |
||
Examples |
int x = 0; void draw() { background(204); if (x < 100) { line(x, 0, x, 100); x = x + 1; } else { noLoop(); } // Saves each frame as screen-0001.tif, screen-0002.tif, etc. saveFrame(); }
int x = 0; void draw() { background(204); if (x < 100) { line(x, 0, x, 100); x = x + 1; } else { noLoop(); } // Saves each frame as line-000001.png, line-000002.png, etc. saveFrame(“line-######.png”); } |
||
Description |
Saves a numbered sequence of images, one image each time the function is run. To save an image that is identical to the display window, run the function at the end of draw() or within mouse and key events such as mousePressed() and keyPressed(). Use the Movie Maker program in the Tools menu to combine these images to a movie. If saveFrame() is used without parameters, it will save files as screen-0000.tif, screen-0001.tif, and so on. You can specify the name of the sequence with the filename parameter, including hash marks (####), which will be replaced by the current frameCount value. (The number of hash marks is used to determine how many digits to include in the file names.) Append a file extension, to indicate the file format to be used: either TIFF (.tif), TARGA (.tga), JPEG (.jpg), or PNG (.png). Image files are saved to the sketch’s folder, which may be opened by selecting “Show Sketch Folder” from the “Sketch” menu. Alternatively, the files can be saved to any location on the computer by using an absolute path (something that starts with / on Unix and Linux, or a drive letter on Windows). All images saved from the main drawing window will be opaque. To save images without a background, use createGraphics(). 保存图像的编号序列, 每次运行该函数时都有一个图像。若要保存与显示窗口相同的图像, 请在绘图末尾 () 或在鼠标和键事件 (如 mousePressed () 和 keyPressed ()) 中运行该函数。使用 “工具” 菜单中的 “影片制作器” 程序将这些图像组合到电影中。
如果使用无参数的 saveFrame (), 则将文件保存为屏幕-0000. tif, 屏幕-0001. tif 等。您可以用文件名参数指定序列的名称, 包括哈希标记 (##), 这些符号将被当前的 frameCount 值替换。(哈希标记的数目用于确定文件名中包含的位数。追加文件扩展名, 以指示要使用的文件格式: tiff (. tif)、塔尔加 (. tga)、jpeg (. jpg) 或 png (. png)。图像文件保存到草绘的文件夹中, 可以通过从 “草绘” 菜单中选择 “显示草图文件夹” 来打开。
或者, 可以使用绝对路径 (在 unix 和 linux 上启动的东西, 或 windows 上的驱动器号) 将这些文件保存到计算机上的任何位置。
从主绘图窗口保存的所有图像将不透明。要保存没有背景的图像, 请使用 createGraphics ()。 |
||
Syntax |
saveFrame() saveFrame(filename) |
||
Parameters |
|
||
Returns |
void |
||
Related |
save() |
- 本文固定链接: http://iprocessing.cn/2017/08/01/saveframe保存序列帧/
- 转载请注明: 卡萨布兰卡 于 Processing编程艺术 发表