Class AnimatedGIFOutput
- Namespace
- VisioForge.Core.Types.Output
- Assembly
- VisioForge.Core.dll
Represents configuration settings for animated GIF output format.
public sealed class AnimatedGIFOutput : IVideoEditBaseOutput, IVideoCaptureBaseOutputInheritance
Implements
Inherited Members
Remarks
This class provides settings for creating animated GIF files from video sources. Animated GIFs are widely supported image formats that can display simple animations without requiring video player support. They are ideal for short clips, tutorials, and web content where universal compatibility is important.
The class implements both VisioForge.Core.Types.Output.IVideoEditBaseOutput and VisioForge.Core.Types.Output.IVideoCaptureBaseOutput interfaces, making it suitable for both video editing and video capture scenarios.
Note that GIF format has limitations:
- Limited to 256 colors per frame
- No audio support
- Large file sizes for long animations
- Lower quality compared to modern video formats
Constructors
AnimatedGIFOutput()
Initializes a new instance of the VisioForge.Core.Types.Output.AnimatedGIFOutput class with default settings.
public AnimatedGIFOutput()Remarks
Default configuration:
- Frame rate: 2 fps (suitable for simple animations)
- Forced dimensions: Not set (uses original video dimensions)
These defaults create a basic animated GIF with low frame rate to keep file size manageable. Adjust the settings based on your specific requirements for quality vs. file size.
Properties
ForcedVideoHeight
Gets or sets the forced output height for the animated GIF in pixels.
public int ForcedVideoHeight { get; set; }Property Value
Remarks
Use this property to resize the output GIF to a specific height. The aspect ratio will be maintained if VisioForge.Core.Types.Output.AnimatedGIFOutput.ForcedVideoWidth is not set. Common heights for web-friendly GIFs include:
- 240 pixels: Small size for thumbnails
- 360 pixels: Medium size for social media
- 480 pixels: Standard size for general use
- 720 pixels: High quality (but larger file size)
Smaller dimensions result in smaller file sizes but lower quality. Setting both width and height may result in aspect ratio distortion.
ForcedVideoWidth
Gets or sets the forced output width for the animated GIF in pixels.
public int ForcedVideoWidth { get; set; }Property Value
Remarks
Use this property to resize the output GIF to a specific width. The aspect ratio will be maintained if VisioForge.Core.Types.Output.AnimatedGIFOutput.ForcedVideoHeight is not set. Common widths for web-friendly GIFs include:
- 320 pixels: Small size for mobile devices
- 480 pixels: Medium size for emails and forums
- 640 pixels: Standard size for web content
- 800 pixels: Large size for detailed animations
Smaller dimensions result in smaller file sizes but lower quality. Setting both width and height may result in aspect ratio distortion. Consider the target platform's limitations when choosing dimensions.
FrameRate
Gets or sets the frame rate for the animated GIF.
public VideoFrameRate FrameRate { get; set; }Property Value
Remarks
The frame rate determines how many frames per second the GIF will display. Common frame rates for animated GIFs:
- 1-2 fps: Slideshow-style animations
- 5-10 fps: Simple animations, reduced file size
- 15 fps: Smooth animations with reasonable file size
- 24-30 fps: Video-like quality (large file sizes)
Lower frame rates result in smaller file sizes but choppier animations. Higher frame rates create smoother animations but significantly increase file size. Most web browsers limit GIF playback to around 50 fps.
Note: The actual frame rate may be adjusted based on GIF format limitations (minimum frame delay is 10ms, or 100 fps maximum).
Methods
GetInternalTypeVC()
Gets the internal output format identifier for video capture operations.
public VideoCaptureOutputFormat GetInternalTypeVC()Returns
- VideoCaptureOutputFormat
-
Returns VisioForge.Core.Types.VideoCapture.VideoCaptureOutputFormat.AnimatedGIF to indicate this is an animated GIF output.
Remarks
This method is used internally by the video capture system to identify the output format type. It implements the VisioForge.Core.Types.Output.IVideoCaptureBaseOutput.GetInternalTypeVC interface method.
GetInternalTypeVE()
Gets the internal output format identifier for video editing operations.
public VideoEditOutputFormat GetInternalTypeVE()Returns
- VideoEditOutputFormat
-
Returns VisioForge.Core.Types.VideoEdit.VideoEditOutputFormat.AnimatedGIF to indicate this is an animated GIF output.
Remarks
This method is used internally by the video editing system to identify the output format type. It implements the VisioForge.Core.Types.Output.IVideoEditBaseOutput.GetInternalTypeVE interface method.
Load(string)
Deserializes animated GIF output settings from a JSON string.
public static AnimatedGIFOutput Load(string json)Parameters
jsonstring-
The JSON string containing the serialized animated GIF output settings.
Returns
- AnimatedGIFOutput
-
A new VisioForge.Core.Types.Output.AnimatedGIFOutput instance with settings restored from the JSON string.
Remarks
This method uses the default JSON deserialization options from VisioForge.Core.Helpers.JsonSerializerOptionsHelper. The JSON string should have been created using the VisioForge.Core.Types.Output.AnimatedGIFOutput.Save method or follow the same format. All properties will be restored to their serialized values.
Exceptions
- JsonException
-
Thrown when the JSON string is invalid or cannot be deserialized to an AnimatedGIFOutput object.
Save()
Serializes the current animated GIF output settings to a JSON string.
public string Save()Returns
- string
-
A JSON string representation of the current settings that can be persisted or transmitted.
Remarks
This method uses the default JSON serialization options from VisioForge.Core.Helpers.JsonSerializerOptionsHelper. The resulting JSON includes all configuration properties:
- Frame rate settings
- Forced video dimensions
The serialized settings can be restored later using the VisioForge.Core.Types.Output.AnimatedGIFOutput.Load(System.String) method.