Can't create/modify gifs with Mono
I'm trying to add unit tests to the .Net ImageProcessor library: https://github.com/cosmo0/ImageProcessor/tree/tests
I'm working on Xamarin/Mono on my Mac. Mono seems to have a few problems with animated gifs images.
For my unit tests, I have a bunch of test images, and I load them all and run transformations on each of them. Each time I apply a filter (brightness for instance), it fails when trying to re-create an image.
The failing line is here : https://github.com/cosmo0/ImageProcessor/blob/tests/src/ImageProcessor/Imaging/Formats/GifFormat.cs#L95
It's just an Image.FromStream(stream);
. I'm guessing the stream is wrong ; I tried to save it to a file, and indeed the file is not readable by the image viewer. The weird thing is that on Windows, it seems to be passing the tests perfectly fine: https://ci.appveyor.com/project/cosmo0/imageprocessor
Any idea what I could do to check the stream or fix it ?
Thanks !
Try to reset the stream before calling
Image.FromStream(stream)
like this :
stream.Seek(0, SeekOrigin.Begin);
上一篇: Python ImageIO中动画GIF的自定义帧持续时间
下一篇: 无法用Mono创建/修改GIF