Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from PIL import Image, ImageSequence
|
2 |
+
|
3 |
+
gif = Image.open('example.gif')
|
4 |
+
frames = []
|
5 |
+
|
6 |
+
for frame in ImageSequence.Iterator(gif):
|
7 |
+
frame = frame.convert("RGBA")
|
8 |
+
# 編集処理例: サイズ変更
|
9 |
+
frame = frame.resize((100, 100))
|
10 |
+
frames.append(frame)
|
11 |
+
|
12 |
+
frames[0].save('edited.gif', save_all=True, append_images=frames[1:], loop=0, duration=gif.info['duration'])
|