I was curious as to how to create an animated .gif in C# using the imagemagick library class. This is what i am using so far:
using (MagickImageCollection collection = new MagickImageCollection())
{
//collection.CacheDirectory = @"C:\MyProgram\MyTempDir";
// Add first image and set the animation delay to 100ms
//MagickNET.Initialize(@"C:\Users\johsam\Downloads\Magick\MagickScript.xsd");
collection.Add("Koala.jpg");
collection[0].AnimationDelay = 1;
// Add second image, set the animation delay to 100ms and flip the image
collection.Add("Desert.jpg");
collection[1].AnimationDelay = 100;
collection[1].Flip();
// Optionally reduce colors
QuantizeSettings settings = new QuantizeSettings();
settings.Colors = 256;
collection.Quantize(settings);
// Optionally optimize the images (images should have the same size).
collection.Optimize();
// Save gif
collection.Write("test.Animated.gif");
}
The issue is that although it creates a .gif there is no moving image when you open it. How do you go about stringing the images together to create a moving image?