1
0
mirror of https://github.com/x-hw/amazing-qr.git synced 2025-08-10 22:41:23 +02:00

keep duration with origin gif file

This commit is contained in:
Jian Wang
2016-10-18 15:14:44 +08:00
parent d05f99001a
commit 96a21d71ed

View File

@@ -97,6 +97,7 @@ def run(words, version=1, level='H', picture=None, colorized=False, contrast=1.0
import imageio
im = Image.open(picture)
duration = im.info.get('duration', 0)
im.save(os.path.join(tempdir, '0.png'))
while True:
try:
@@ -113,7 +114,7 @@ def run(words, version=1, level='H', picture=None, colorized=False, contrast=1.0
ims = [imageio.imread(pic) for pic in imsname]
qr_name = os.path.join(save_dir, os.path.splitext(os.path.basename(picture))[0] + '_qrcode.gif') if not save_name else os.path.join(save_dir, save_name)
imageio.mimsave(qr_name, ims)
imageio.mimwrite(qr_name, ims, '.gif', **{ 'duration': duration/1000 })
elif picture:
qr_name = combine(ver, qr_name, picture, colorized, contrast, brightness, save_dir, save_name)
elif qr_name: