Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Animated gif encoder error

There's far too much code to paste into a question here so I have linked to a public gist.

https://gist.github.com/JimBobSquarePants/cac72c4e7d9f05f13ac9

I have an animated gif encoder as part of an image library that I maintain and there is something wrong with it.

If I attempt to upload any gif that have been output by the class to twitter I get an internal server error, though if I pass them through http://ezgif.com/ resizing to the same dimensions first they upload properly.

If I upload the image to http://www.smiliegenerator.us/ to analyse I get the following error

unknown block type 0 at *different position each time*

which indicates to me that I have some sort of buffer offset error though I don't know where.

Would anyone here be able to tell me what has gone wrong?

The full library is hosted on Github here https://github.com/JimBobSquarePants/ImageProcessor/tree/V2

like image 525
James South Avatar asked Oct 16 '14 23:10

James South


1 Answers

To fix remove

// Complete Application Block
this.WriteByte(0);

at line 253

This was adding an extra unnecessary byte before the terminator.

like image 180
James South Avatar answered Sep 30 '22 03:09

James South