Skip to content

Instantly share code, notes, and snippets.

@yuchen-xue
Created April 23, 2025 20:56
Show Gist options
  • Save yuchen-xue/3f21409bc3edb7e33ae5df85a0d0f840 to your computer and use it in GitHub Desktop.
Save yuchen-xue/3f21409bc3edb7e33ae5df85a0d0f840 to your computer and use it in GitHub Desktop.
Resize a gif file from a URL and store it locally
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