AnimatedImage[{image1,image2,…}]
生成帧为连续图像 imagei 的动图.
AnimatedImage[file]
代表 file 中的一个动图.
AnimatedImage
AnimatedImage[{image1,image2,…}]
生成帧为连续图像 imagei 的动图.
AnimatedImage[file]
代表 file 中的一个动图.
更多信息和选项
- AnimatedImage 可用于将一系列图像展示为动图. 动图通常都以 GIF 和 PNG 的格式储存.
- 在 AnimatedImage[file] 中,file 可为以下任意形式:
-
File["file"] 或 "file" 文件名,在 $Path 上搜索 URL["url"] 或 "url" HTTP、HTTPS 或 FTP URL CloudObject[…] 云对象 LocalObject[…] 本地对象 Video[…] 视频对象 - 语句 AnimatedImage[…][prop] 可用于提取特定属性.
- 支持下列属性:
-
"AnimationRepetitions" 重复动画的次数 "Channels" 图像通道的数量 "ColorSpace" 数据可以假设的色彩空间 "DataType" 底层数据类型 "FrameRate" 使用的帧率 "ImageCount" 图像的数量 "ImageList" 所有图像 "Interleaving" 数据是否以交错方式储存 "RasterSize" 图像的像素维度 "TotalDuration" 总持续时间 "Transparency" 图像是否有透明 (alpha) 通道 - 可以指名下列选项:
-
AnimationRepetitions Infinity 停止之前运行的次数 AnimationRunning True 动画是否运行 DefaultDuration Automatic 以秒计的默认时长 FrameRate Automatic 图像显示的速率 ImageSize Inherited 使用的图像总大小 RasterSize Automatic 图像帧的维度 RefreshRate Automatic 默认的每秒刷新次数 - AnimatedImage 的 Information 包括以下属性:
-
"AnimationRepetitions" 重复动画的次数 "Channels" 图像通道的个数 "ColorSpace" 数据可以假设的色彩空间 "DataType" 底层数据类型 "FrameRate" 使用的帧率 "ImageCount" 图像的数量 "ImageDimensions" 像素维度 "Interleaving" 数据是否以交错方式储存 "RasterSize" 图像的像素维度 "TotalDuration" 总持续时间 "Transparency" 图像是否有透明 (alpha) 通道 - 支持 AnimatedImage 的基本图像编辑函数有:ColorConvert、ImageCrop、ImagePad、ImageReflect、ImageResize、ImageRotate、ImageTake 和 ImageTrim.
- 使用 Video 和 ListAnimate 可将动图转换为相应的对象.
范例
打开所有单元 关闭所有单元基本范例 (3)
AnimatedImage["ExampleData/wave.gif"]AnimatedImage[Rasterize[Style[#, 40]]& /@ Range[0, 9], FrameRate -> 6]t = Table[With[{h = h}, LinearGradientImage[Hue[# + h, .5]&, 50]], {h, 0, 1, .1}]AnimatedImage[t, FrameRate -> 6]范围 (7)
数据 (4)
list = Table[Image[Hue[h, .8, .9]], {h, 0, 1, 1 / 40}]AnimatedImage[list, ImageSize -> 50]AnimatedImage["ExampleData/pearls.png"]Information[%]AnimatedImage[Import["ExampleData/pearls.png", ImageSize -> 100]]Information[%]AnimatedImage[Video["ExampleData/fish.mp4"]]属性 (3)
list = AnimatedImage["ExampleData/wave.gif"]["ImageList"];Downsample[list, 5]AnimatedImage["ExampleData/wave.gif"]["FrameRate"]AnimatedImage["ExampleData/wave.gif"]["TotalDuration"]AnimatedImage["ExampleData/wave.gif", FrameRate -> 5]["TotalDuration"]选项 (6)
AnimationRepetitions (1)
使用 AnimationRepetitionsn 可将动图仅播放 n 次:
AnimatedImage["ExampleData/wave.gif", AnimationRepetitions -> 3]使用 AnimationRepetitions∞ 可持续播放动图:
AnimatedImage["ExampleData/wave.gif", AnimationRepetitions -> ∞]AnimationRunning (1)
使用 AnimationRunning 可指定动图是否默认播放:
AnimatedImage["ExampleData/pearls.png", AnimationRunning -> True]AnimatedImage["ExampleData/pearls.png", AnimationRunning -> False]DefaultDuration (2)
使用 DefaultDurations 可控制一次动态循环的时长:
AnimatedImage[Import["ExampleData/wave.gif"], DefaultDuration -> 2]从超过 5 秒的视频创建动画图像时,动画根据片段视频制作而来:
AnimatedImage[Video["ExampleData/bullfinch.mkv"]]%["TotalDuration"]Duration@Video["ExampleData/bullfinch.mkv"]FrameRate (1)
使用 FrameRaten 可每秒至多显示 n 帧:
AnimatedImage["ExampleData/wave.gif", FrameRate -> 40]RefreshRate (1)
使用 RefreshRaten 可使每秒刷新动图至多 n 次:
AnimatedImage["ExampleData/wave.gif", RefreshRate -> 3]应用 (2)
g = ExampleData[{"Geometry3D", "Cow"}][[1, 2]];list = Table[Rasterize[Graphics3D[{EdgeForm[], GeometricTransformation[g, RotationTransform[a Degree, {0, 0, 1}]]}, SphericalRegion -> True, Boxed -> False], RasterSize -> 100], {a, 0, 360, 5}];AnimatedImage[list]a = AnimatedImage["ExampleData/wave.gif"]AnimatedImage[ColorNegate /@ a["ImageList"]]属性和关系 (4)
直接对 AnimatedImage 使用结构性图像操作:
a = AnimatedImage["ExampleData/pearls.png"]ImagePad[a, 10]ImageResize[a, 100]使用 ListAnimate 可显示动画控制条:
ListAnimate[AnimatedImage["ExampleData/wave.gif"]]使用 Video 可将动图转换成一个视频对象:
Video[AnimatedImage["ExampleData/wave.gif"]]使用 Information 可将 AnimatedImage 对象的信息可视化:
Information[AnimatedImage["ExampleData/wave.gif"]]Information[AnimatedImage["ExampleData/wave.gif"], "ImageCount"]互动范例 (1)
使用 Manipulate 可交互控制动图设置:
Manipulate[AnimatedImage["ExampleData/pearls.png", FrameRate -> fr, RefreshRate -> rr, ImageSize -> size],
{{fr, 16, "FrameRate"}, 10, 50}, {{rr, 20, "RefreshRate"}, 2, 20},
{{size, 100, "ImageSize"}, 50, 150}]文本
Wolfram Research (2020),AnimatedImage,Wolfram 语言函数,https://reference.wolfram.com/language/ref/AnimatedImage.html (更新于 2021 年).
CMS
Wolfram 语言. 2020. "AnimatedImage." Wolfram 语言与系统参考资料中心. Wolfram Research. 最新版本 2021. https://reference.wolfram.com/language/ref/AnimatedImage.html.
APA
Wolfram 语言. (2020). AnimatedImage. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/ref/AnimatedImage.html 年
BibTeX
@misc{reference.wolfram_2026_animatedimage, author="Wolfram Research", title="{AnimatedImage}", year="2021", howpublished="\url{https://reference.wolfram.com/language/ref/AnimatedImage.html}", note=[Accessed: 07-July-2026]}
BibLaTeX
@online{reference.wolfram_2026_animatedimage, organization={Wolfram Research}, title={AnimatedImage}, year={2021}, url={https://reference.wolfram.com/language/ref/AnimatedImage.html}, note=[Accessed: 07-July-2026]}