# pip install Pillow # pip install pyzbar import pyzbar.pyzbar as pyzbar from PIL import Image, ImageEnhance image = "cs1.jpg" img = Image.open(image) # img = ImageEnhance.Brightness(img).enhance(2.0)#增加亮度 # img = ImageEnhance.Sharpness(img).enhance(17.0)#锐利化 # img = ImageEnhance.Contrast(img).enhance(4.0)#增加对比度 # img = img.convert('L')#灰度化 # img.show() #显示图片 barcodes = pyzbar.decode(img, symbols=[64]) for barcode in barcodes: url = barcode.data.decode("utf-8") print(url)