Created
December 21, 2020 13:13
-
-
Save showyou/cb52c1588dd53675e7a54c09f8ea5c7b to your computer and use it in GitHub Desktop.
gen_image.py
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
from PIL import Image, ImageDraw | |
images = [] | |
before = 20 | |
frames = 30 + 1 | |
after = 20 | |
s = (0xff, 0xff) | |
e = (0x8e, 0x00) | |
w = ((s[0] - e[0])//frames, (s[1] - e[1])//frames) | |
for i in range(before): | |
img = Image.new('RGBA', (200, 200), 'white') | |
images.append(img) | |
for i in range(frames): | |
img = Image.new('RGBA', (200, 200), (0xff, s[0] - w[0] * i, s[1] - w[1] * i)) | |
images.append(img) | |
for i in range(after): | |
img = Image.new('RGBA', (200, 200), (0xff, e[0], e[1])) | |
images.append(img) | |
images[0].save('white2orange.gif', save_all=True, append_images=images[1:], optimize=False, duration=50, loop=0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment