def produce(txt,img,ver=5,err_crt = qrcode.constants.ERROR_CORRECT_H,bri = 1.0, cont = 1.0,\
colourful = False, rgba = (0,0,0,255),pixelate = False):
"""Produce QR code
:txt: QR text
:img: Image path / Image object
:ver: QR version
:err_crt: QR error correct
:bri: Brightness enhance
:cont: Contrast enhance
:colourful: If colourful mode
:rgba: color to replace black
:pixelate: pixelate
:returns: list of produced image
"""
if type(img) is Image.Image:
pass
elif type(img) is str:
img = Image.open(img)
else:
return []
frames = [produce_impl(txt,frame.copy(),ver,err_crt,bri,cont,colourful,rgba,pixelate) for frame in ImageSequence.Iterator(img)]
return frames
评论列表
文章目录