Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jimp stucking at a corrupted GIF file #353

Closed
nodegin opened this issue Oct 6, 2017 · 6 comments · Fixed by #510
Closed

Jimp stucking at a corrupted GIF file #353

nodegin opened this issue Oct 6, 2017 · 6 comments · Fixed by #510
Projects

Comments

@nodegin
Copy link

nodegin commented Oct 6, 2017

I found this GIF file will cause Jimp stuck forever (right click to save):

1

Code snippet for reproducing this issue:

const Jimp = require('jimp')

Jimp.read(`1.gif`, (err, image) => {
  console.log(image, err)
})
@jtlapp
Copy link

jtlapp commented Oct 10, 2017

Thanks for this. I'm writing a package that adds GIF support to Jimp by wrapping it, will see if I can fix it in my wrapping module.

@jtlapp
Copy link

jtlapp commented Oct 13, 2017

omggif.js is hanging. The GIF appears to be ill-formed, but the decoder shouldn't be hanging. I think it's fair to simply reject the image. I'll look into it.

No one is maintaining Jimp any more, but I'll be able to fix it from my GIF wrapper. You don't want to be using Jimp directly for GIFs anyway.

@nodegin
Copy link
Author

nodegin commented Oct 13, 2017

@jtlapp Nice work for finding out what the problem is.

@jtlapp
Copy link

jtlapp commented Dec 20, 2017

I've provided GIF support and a working decoder in gifwrap. Thanks for finding the bug and providing a test case.

@hipstersmoothie
Copy link
Collaborator

@jtlapp any reason why you didn't try to add GIF support directly to jimp?

@jtlapp
Copy link

jtlapp commented Aug 5, 2018

Oh sorry, somehow I missed the question. There are two issues related to GIF support. One is getting single frame GIFs to load at all. The problem was in omggif. I submitted the problem to omggif along with a solution, although the author opted for a different solution. Use the existing omggif repo, instead of a local copy. and this problem will go away.

The second issue with GIFs is supporting animations. Jimp is architected to operate on exactly one image at a time. All the stuff that's needed to support GIF animations is outside the purview of Jimp. It's stuff that would wrap Jimp. I attempted to wrap Jimp but found the Jimp constructors so non-standard that it wasn't possible without great headache. Instead, I made a Jimp-compatible solution that allows you to copy the bitmap back and forth between Jimp and gifwrap.

I guess the final reason is that Jimp is written inefficiently and applies a mistaken understanding of async callbacks. I didn't want to build anything on it.

@hipstersmoothie hipstersmoothie moved this from Todo to Done in V1 Aug 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
V1
Done
Development

Successfully merging a pull request may close this issue.

3 participants