I have been trying out Magick.NET in my web application with success until I attempted to create animated gifs. When I try to call `collection.ToByteArray()` or `collection.Write(stream)` the application crashes. No exception, just crashes.
Here is my simple function
```
public byte[] CreateWithImageMagic(Bitmap[] images) {
try {
using (var collection = new MagickImageCollection()) {
foreach (Bitmap t in images) {
var imageMagicItem = new MagickImage(t) { AnimationDelay = 100 };
collection.Add(imageMagicItem);
}
collection.Optimize();
using (var stream = new MemoryStream()) {
collection.ToByteArray(); // This call kills the app
collection.Write(stream); // This call kills the app
collection.ForEach(i => i.Dispose());
return stream.ToArray();
}
}
}
catch (Exception ex) {
throw ex;
}
}
```
If I use the `Write(String)` overload (path on disc) the code executes successfully and the animated gif is created. This is an ASP.NET MVC 4 application running .NET 4.5.1 and using the x86 build. Any ideas?
Here is my simple function
```
public byte[] CreateWithImageMagic(Bitmap[] images) {
try {
using (var collection = new MagickImageCollection()) {
foreach (Bitmap t in images) {
var imageMagicItem = new MagickImage(t) { AnimationDelay = 100 };
collection.Add(imageMagicItem);
}
collection.Optimize();
using (var stream = new MemoryStream()) {
collection.ToByteArray(); // This call kills the app
collection.Write(stream); // This call kills the app
collection.ForEach(i => i.Dispose());
return stream.ToArray();
}
}
}
catch (Exception ex) {
throw ex;
}
}
```
If I use the `Write(String)` overload (path on disc) the code executes successfully and the animated gif is created. This is an ASP.NET MVC 4 application running .NET 4.5.1 and using the x86 build. Any ideas?