Hi, trying to create an animated gif however there's something weird (at least from what I can tell) going on.
Can't get MagickImageCollection.Write to stream to work as it should, end result never gets animated.
Written a test console app that uses a list of filenames and renders an animated gif.
If I then do a:
If I instead write to a stream and then write the output to a gif file using a MagickImage. All I get seems to be the first frame? (previewing in chrome)
As you can see I do this to be able to set AnimationIterations for the gif. Any reason for that setting not being available on the MagickImageCollection object, so one could skip to load the output from collection to a magickimage? Using the latest stable release at the moment, fresh from nuget. 16 anycpu.
Can't get MagickImageCollection.Write to stream to work as it should, end result never gets animated.
Written a test console app that uses a list of filenames and renders an animated gif.
using (var collection = new MagickImageCollection())
{
// Add first image and set the animation delay to 200
foreach (var file in sourceFiles.Where(x => x.EndsWith("png")))
{
Trace.TraceInformation("ADDED: " + file);
var image = new MagickImage(file, new MagickReadSettings { Format = MagickFormat.Png }) { AnimationDelay = 200 };
collection.Add(image);
}
// Reduce colors
var settings = new QuantizeSettings { Colors = 256 };
collection.Quantize(settings);
// Optimize the images
collection.OptimizePlus();
So far so good. If I then do a:
collection.Write("filename.gif");
gif seems to work fine.If I instead write to a stream and then write the output to a gif file using a MagickImage. All I get seems to be the first frame? (previewing in chrome)
As you can see I do this to be able to set AnimationIterations for the gif. Any reason for that setting not being available on the MagickImageCollection object, so one could skip to load the output from collection to a magickimage? Using the latest stable release at the moment, fresh from nuget. 16 anycpu.
var gifStream = new MemoryStream();
collection.Write(gifStream);
gifStream.Position = 0;
using (var gif = new MagickImage(gifStream) { AnimationIterations = 5 })
{
gif.Write("filename.gif");
}
Am I missing something or is there a bug?