Animation Maker Licensing Plugin

Contents
[ ]

         Utilize the Animation Maker Licensing Plugin to effortlessly create animations from your images. In the C# code example provided below, we begin by configuring the Metered license settings, unlocking the animation-making feature by providing the public key and private password using the `SetMeteredKey()` method. Please note that using unlicensed features of the Aspose.Imaging graphic library will result in a watermark appearing on the output images. You can use your images to make animations from a variety of image files in different formats from the list of supported image formats, seamlessly adding them to the output file, such as an animated GIF format. You have complete control over animation parameters and can define the desired frame duration and overall duration. Loaded images can be seamlessly added to the animated GIF file using the GifImage.AppPage() method before saving it to the output file.

using Aspose.Imaging;
using Aspose.Imaging.FileFormats.Gif;
using Aspose.Imaging.FileFormats.Gif.Blocks;
using Aspose.Imaging.ImageOptions;
using Aspose.Imaging.Sources;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using static System.Net.Mime.MediaTypeNames;
string templatesFolder = @"c:\Users\USER\Downloads\templates\";
string dataDir = templatesFolder;
Run();
//------------------------------------------------------------------------
// Animation maker plug-in use sample
//------------------------------------------------------------------------
void Run()
{
// Valid Animation maker license use example
Metered license = new Metered();
// Only metered plug-in license is supported
license.SetMeteredKey("<your public key>", "<your private key>");
string OutputDirectory = templatesFolder;
const int AnimationDuration = 1000;
const int FrameDuration = 42;
GifImage gifImage = null;
try
{
foreach (var inputFilePath in Directory.GetFiles(templatesFolder, "*.jpg"))
{
RasterImage sourceImage = (RasterImage)Image.Load(inputFilePath);
{
if (gifImage == null)
{
GifOptions createOptions = new GifOptions
{
Source = new FileCreateSource(outputFilePath, false),
BackgroundColor = Color.Transparent,
FullFrame = true,
LoopsCount = (int)(AnimationDuration / FrameDuration),
Palette = ColorPaletteHelper.GetCloseImagePalette(sourceImage, 256)
};
gifImage = (GifImage)Image.Create(
createOptions,
sourceImage.Width,
sourceImage.Height);
gifImage.InsertBlock(0, new GifGraphicsControlBlock());
gifImage.SetFrameTime((ushort)FrameDuration);
if (gifImage.PageCount > 0)
{
gifImage.RemoveBlock((IGifBlock)gifImage.Pages[0]);
}
}
// add frame
gifImage.AddPage(sourceImage);
}
}
}
finally
{
if (gifImage != null)
{
gifImage.Save();
gifImage.Dispose();
}
}
}

Discover the features and capabilities of our free online Aspose.Imaging Animation Maker App website.