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

cannot handle transparency correctly #1

Closed
EyMaddis opened this issue Aug 24, 2016 · 6 comments
Closed

cannot handle transparency correctly #1

EyMaddis opened this issue Aug 24, 2016 · 6 comments

Comments

@EyMaddis
Copy link

Hi,
using the following url in your demo (http://matt-way.github.io/gifuct-js/) will show that transparency is overlaying:
http://cors-anywhere.herokuapp.com/http://i.stack.imgur.com/e8nZC.gif

image

@matt-way
Copy link
Owner

While I could extend the demo to render transparency correctly, the demo is merely there to give you a starting point when building your own renderer. This project is about making it easy for you to extract and parse the internal gif information, not be a go to renderer. This is because everyone has different rendering requirements.

@ronelzb
Copy link

ronelzb commented Mar 25, 2017

Good evening, I'm trying to integrate this project into one of my own to get the Frames of a gif specifically. I can't use XMLHttpReader so instead I used a Canvas and embedded the gif to get the base64Image encoding. The issue is that when I try to initialize a Gif object I don't get the Frames arrays and even haven't been able to run the demo locally: When I click Load into any image the container stays white. Also, how can I change those require strings because I need to be able to change the location of the js files and in some cases I would need absolute location. Thanks.

@EyMaddis
Copy link
Author

@rojozabe please do not hijack Github issues unrelated to your issue.
Despite that here is my advice:
check the JS console, you will probably see an access control (CORS) issue. To solve this, the server, the images come from, has to set some headers.
In my post above I just prefixed the URL of the image with
http://cors-anywhere.herokuapp.com/

Test it by putting it in front of your image URL and try again.

@donpark
Copy link

donpark commented Feb 12, 2021

This is what worked for me when rendering frames without overlapping:

  1. Keep track of last frame's disposalType.
  2. Before rendering a frame, clearRect if frameIndex is 0 or last frame's disposalType is 2.

This makes sense because the term disposal implies what to do with output of the frame before rendering the next frame. And when it's the first frame, there is no previous frame so clearing is implicit even if looped back to the first frame.

@matt-way
Copy link
Owner

@jeetiss added a disposal check to a recent pr mentioned, so hopefully this is fixed in the demo, but yeah I do believe this is what was missing.

@donpark
Copy link

donpark commented Feb 17, 2021

Agreed. libgif.js does handle disposalType: 3 by keeping a copy of the previous full frame but I have yet to see one in-use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants