Created
April 23, 2025 20:56
-
-
Save yuchen-xue/3f21409bc3edb7e33ae5df85a0d0f840 to your computer and use it in GitHub Desktop.
Resize a gif file from a URL and store it locally
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import numpy as np | |
import imageio.v3 as iio | |
from pygifsicle import optimize | |
im = iio.imread( | |
'https://github.com/yuchen-xue/Spring-MySQL-TF-Detection/raw/master/asset/demo.gif', index=None) | |
stacked_frames = np.stack([ | |
cv2.resize(frame, (640, 360), interpolation=cv2.INTER_AREA) for frame in im | |
], axis=0) | |
iio.imwrite('Springboot-detection-demo.gif', stacked_frames) | |
optimize('Springboot-detection-demo.gif') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment