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

Add API to check if a GIF is animated #114

Merged
merged 1 commit into from Jun 14, 2020
Merged

Conversation

nbianca
Copy link
Contributor

@nbianca nbianca commented May 18, 2020

No description provided.

@Nakilon
Copy link
Contributor

Nakilon commented May 18, 2020

What if it's animated but has one frame? Or two frames that are equal?

@nbianca
Copy link
Contributor Author

nbianca commented May 18, 2020

This is a best effort approach, which tries to determine if the user would perceive it as animated (thus, if it has one frame and it is "animated", then it is no problem).

I did not try to solve the other problem because any solution I came up required full parsing of the GIF image and defeated the philosophy of the library (do things quickly with as little data as possible).

@Nakilon
Copy link
Contributor

Nakilon commented May 18, 2020

As user I would probably be ok if it was just giving the number of frames.

@sdsykes
Copy link
Owner

sdsykes commented May 19, 2020

It would be better to call the api "animated?" and return a boolean value.

if FastImage.animated?(gif_file)
  ...do something
end

@nbianca nbianca force-pushed the master branch 2 times, most recently from 6c83d28 to c59b45e Compare May 21, 2020 11:38
@sdsykes
Copy link
Owner

sdsykes commented May 26, 2020

Hi, looking good.

Fix the inline documentation to match?

@nbianca
Copy link
Contributor Author

nbianca commented Jun 2, 2020

Hi @sdsykes! I've made the necessary changes to match documentation. Can you have another look? 😊

@sdsykes
Copy link
Owner

sdsykes commented Jun 2, 2020

Thanks I think this is ok, I will final check and merge/release soon.

lib/fastimage.rb Outdated Show resolved Hide resolved
lib/fastimage.rb Outdated Show resolved Hide resolved
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

Successfully merging this pull request may close these issues.

None yet

3 participants