Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 !

like image 525
thomasb Avatar asked Jun 28 '14 19:06

thomasb


People also ask

What is alpha threshold in Procreate GIF?

The Threshold Alpha command converts semi-transparent areas of the active layer into completely transparent or completely opaque areas, based on a threshold you set, between 0 and 255. It only works on layers of RGB images which have an alpha channel.

How can I remove text from a GIF?

To remove text from JPEG/JPG/GIF/PNG/BMP images, you can use the iMyFone MarkGo tool. Just install the software and click on the 'Remove Watermark' option to upload the file and to erase the unwanted text.


1 Answers

Try to reset the stream before calling

Image.FromStream(stream)

like this :

stream.Seek(0, SeekOrigin.Begin);

like image 56
Robert Avatar answered Sep 18 '22 16:09

Robert