扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
PIL基本功能介绍
创新互联主要从事成都网站设计、网站制作、网页设计、企业做网站、公司建网站等业务。立足成都服务康保,十多年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:13518219792from PIL import Image from PIL import ImageEnhance img = Image.open(r'E:\img\f1.png') img.show() #图像二值化 img = img.convert('L') # 图像放大 img = img.resize((img.width * int(3), img.height * int(4)), Image.ANTIALIAS) # # 对比度增强 enh_con = ImageEnhance.Contrast(img) contrast = 2 img_contrasted = enh_con.enhance(contrast) # 亮度增强 enh_bri = ImageEnhance.Brightness(img_contrasted) brightness = 2.5 image_brightened = enh_bri.enhance(brightness) #色度增强 enh_col = ImageEnhance.Color(img) color = 50 image_colored = enh_col.enhance(color) # # 锐度增强 enh_sha = ImageEnhance.Sharpness(img) sharpness = 2 image_sharped = enh_sha.enhance(sharpness) image_sharped.save(r'E:\img\f22.png', dpi=(300, 300), quality=95) # image_sharped.save(r'E:\img\f22.png') # 图片汉字识别 img2 = Image.open(r'E:\img\f22.png') code2 = pytesseract.image_to_string(img2, lang='chi_sim') # print(code2) # 图片裁剪 image_cro = Image.open(r'E:\img\f24.png') image_cropped = image_cro.crop(res) image_cropped.save(u'E:\img\\f25.png')
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流