-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
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
emoji: Add support for animated GIF images. #9968
Conversation
Hello @zulip/server-emoji members, this pull request was labeled with the "area: emoji" label, so you may want to check it out! |
2f682b8
to
b963024
Compare
@timabbott FYI. Mypy is complaining because there are no stub files available for |
b963024
to
a2da13d
Compare
@timabbott Gentle ping on this. What can I do to fix the mypy issue? |
For the mypy error, there are two options. Either edit |
This commit adds 'resize_gif()' function which extracts each frame, resize it and coalesces them again to form the resized GIF while preserving the duration of the GIF. I read some stackoverflow answers all of which were referring to BiggleZX's script (https://gist.github.com/BigglesZX/4016539) for working with animated GIF. I modified the script to fit to our usecase and did some manual testing but the function was failing for some specific GIFs and was not preserving the duration of animation. So I went ahead and read about GIF format itself as well as PIL's `GifImagePlugin` code and came up with this simple function which gets the worked done in a much cleaner way. I tested this function on a number of GIF images from giphy.com and it resized all of them correctly. Fixes: zulip#9945.
a2da13d
to
c61811d
Compare
Nice, merged, thanks @HarshitOnGitHub! |
Nice job on the resizing ! |
That seems quite likely. @julievalet can you open a new issue for that and mention @HarshitOnGitHub on the thread? |
Here is the created issue : #10351 |
This commit adds 'resize_gif()' function which extracts each frame,
resize it and coalesces them again to form the resized GIF while
preserving the duration of the GIF. I read some stackoverflow
answers all of which were referring to BiggleZX's script
(https://gist.github.com/BigglesZX/4016539) for working with animated
GIF. I modified the script to fit to our usecase and did some manual
testing but the function was failing for some specific GIFs and was not
preserving the duration of animation. So I went ahead and read about
GIF format itself as well as PIL's
GifImagePlugin
code and came upwith this simple function which gets the worked done in a much cleaner
way. It tested this function on a number of GIF images from giphy.com
and it resized all of them correctly.
Fixes: #9945.