(NOTE: this functionality is available starting from .NET 2.0 version of the library)
Introduction
Saving a snapshot of the frame is very easy with new Aspose.Flash frame rendering feature (available from version 1.6.2), it’s implemented using fully managed .NET code and brings you an ability to save any desired frame of the movie to an image.
Remarks
Frame content is rendered statically, without any internal Action Script executions, our renderer only renders display list content defined for the given frame.
List of the supported elements includes:
1) shapes with solid, gradient and bitmap fill or clipping shapes
2) static and dynamic text, with embedded or system fonts
3) morph shapes support
4) buttons support
5) sprites
Bitmap filters and blending modes are not supported by the moment for DefineButton and PlaceObject3 tags as well as DefineFont4 tag introduced with swf 10.
RenderFrame method
The RenderFrame method creates a flash container, loads a movie into it and demonstrates usage of the rendering feature.
[C#]
//Create a flash container/flash file
FlashContainer flash = new FlashContainer();
//Reads the movie from disk
flash.ReadFromFile(“movie.swf”);
//Render the first frame of the movie
Image image = flash.Render();
//Write snapshot on disk
image.SaveToFile("snapshot.png",System.Drawing.Imaging.ImageFormat.Png);
[VB.NET]
'Create a flash container or flash file
Dim flash As New FlashContainer()
'Reads the movie from disk
flash.ReadFromFile("movie.swf")
Render the first frame of the movie
Dim image As Image = flash.Render()
'Write snapshot on disk
image.SaveToFile("snapshot.png", System.Drawing.Imaging.ImageFormat.Png)
Summary
In this article, we learnt how to save particular frames of the swf movie into image files.