I follow the step at Resize GIF animation, pil/imagemagick, python to resize image using PIL
and image2gif
. However, I got the resized gif washed out like below:
How do I solve this problem?
Here is my code
from PIL import Image, ImageSequence
filename = "demo.gif"
new_width = 100
new_height = 100
with Image.open(filename) as im:
frames = []
for frame in ImageSequence.Iterator(im):
frame = frame.resize((new_width, new_height))
frames.append(frame)
print(f"length of freames {len(frames)}")
frames[0].save('resized_image.gif', save_all=True, append_images=frames[1:])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With