首页 > 文档 > saveFrame()保存序列帧
2017
08-01

saveFrame()保存序列帧

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();

}

saveFrame()保存序列帧 - 第1张  | Processing编程艺术

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

filename

String: any sequence of letters or numbers that ends with either “.tif”, “.tga”, “.jpg”, or “.png”

“. tif”“. tga”“. jpg” “. png” 结尾的任何字母或数字序列

Returns

void

Related

save()
createGraphics()
frameCount



最后编辑:
作者:卡萨布兰卡
这个作者貌似有点懒,什么都没有留下。

留下一个回复

你的email不会被公开。