1
0
mirror of https://github.com/x-hw/amazing-qr.git synced 2025-07-15 01:24:37 +02:00

Merge pull request #10 from northlandsnow/fix/keep-duration

keep duration with origin gif file
This commit is contained in:
FAR
2016-11-13 18:03:47 +08:00
committed by GitHub

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: