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

change format of images

This commit is contained in:
sylnsfar
2016-09-05 12:59:30 +08:00
parent a2e742726b
commit b0799d2094
2 changed files with 3 additions and 3 deletions

View File

@ -14,7 +14,7 @@ def draw_qrcode(abspath, qrmatrix, unit_len):
x += unit_len x += unit_len
x, y = 4*unit_len, y+unit_len x, y = 4*unit_len, y+unit_len
saving = os.path.join(abspath, 'qrcode.jpg') saving = os.path.join(abspath, 'qrcode.png')
pic.save(saving) pic.save(saving)
return saving return saving

View File

@ -51,7 +51,7 @@ def combine(qr_name, bg_name, colorized, contrast, brightness, save_place):
if not ((i in (18,19,20)) or (j in (18,19,20)) or (i<24 and j<24) or (i<24 and j>qr.size[1]-49) or (i>qr.size[0]-49 and j<24) or ((i,j) in aligs) or (i%3==1 and j%3==1) or (bg0.getpixel((i,j))[3]==0)): if not ((i in (18,19,20)) or (j in (18,19,20)) or (i<24 and j<24) or (i<24 and j>qr.size[1]-49) or (i>qr.size[0]-49 and j<24) or ((i,j) in aligs) or (i%3==1 and j%3==1) or (bg0.getpixel((i,j))[3]==0)):
qr.putpixel((i+12,j+12), bg.getpixel((i,j))) qr.putpixel((i+12,j+12), bg.getpixel((i,j)))
qr_name = os.path.join(save_place, os.path.splitext(bg_name)[0] + '_qrcode.jpg') qr_name = os.path.join(save_place, os.path.splitext(bg_name)[0] + '_qrcode.png')
qr.resize((qr.size[0]*2, qr.size[1]*2)).save(qr_name) qr.resize((qr.size[0]*2, qr.size[1]*2)).save(qr_name)
return qr_name return qr_name
@ -95,6 +95,6 @@ elif args.picture:
import shutil import shutil
if os.path.exists('temp'): if os.path.exists('temp'):
shutil.rmtree('temp') shutil.rmtree('temp')
if qr_name is not None: if qr_name is not None:
print('Succeed! \nCheck out your ' +str(ver) + '-' + str(ecl) + ' QR-code at', qr_name) print('Succeed! \nCheck out your ' +str(ver) + '-' + str(ecl) + ' QR-code at', qr_name)