Quantcast
Channel: magick Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 1011

Commented Issue: ToByteArray and Write(Stream) for MagickImageCollection kill application [1169]

$
0
0
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?
Comments: ** Comment from web user: dlemstra **

It turns out that ImageMagick does support writing other formats. I will investigate this further.


Viewing all articles
Browse latest Browse all 1011

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>