Skip to content

Commit

Permalink
update the importing and the output-name of gif
Browse files Browse the repository at this point in the history
  • Loading branch information
x-hw committed Sep 5, 2016
1 parent b0799d2 commit 0138ebe
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
File renamed without changes.
9 changes: 5 additions & 4 deletions myqr.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-

import argparse, os, theqrmodule
import argparse, os
from mylibs import theqrmodule

# Alignment Pattern Locations
alig_location = [
Expand Down Expand Up @@ -67,11 +68,11 @@ def combine(qr_name, bg_name, colorized, contrast, brightness, save_place):
ver, qr_name = theqrmodule.get_qrcode(ver, ecl, args.WORDs, save_place, bool(args.picture))

if args.picture and args.picture[-4:]=='.gif':
print('it takes a while, please wait for minutes...')

from PIL import Image
import imageio

print('it takes a while, please wait for minutes...')

im = Image.open(args.picture)
im.save('temp/0.png')
while True:
Expand All @@ -88,7 +89,7 @@ def combine(qr_name, bg_name, colorized, contrast, brightness, save_place):
imsname.append(combine(qr_name, bg_name, args.colorized, args.contrast, args.brightness, ''))

ims = [imageio.imread(pic) for pic in imsname]
qr_name = os.path.splitext(args.picture)[0] + '_qrcode.gif'
qr_name = os.path.join(os.path.abspath('.'), os.path.splitext(args.picture)[0] + '_qrcode.gif')
imageio.mimsave(qr_name, ims)
elif args.picture:
qr_name = combine(qr_name, args.picture, args.colorized, args.contrast, args.brightness, os.path.abspath('.'))
Expand Down

0 comments on commit 0138ebe

Please sign in to comment.