PIL基本功能介紹
創(chuàng)新互聯(lián)主要從事成都網(wǎng)站設(shè)計(jì)、網(wǎng)站制作、網(wǎng)頁(yè)設(shè)計(jì)、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)康保,十多年網(wǎng)站建設(shè)經(jīng)驗(yàn),價(jià)格優(yōu)惠、服務(wù)專(zhuān)業(yè),歡迎來(lái)電咨詢建站服務(wù):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) # # 對(duì)比度增強(qiáng) enh_con = ImageEnhance.Contrast(img) contrast = 2 img_contrasted = enh_con.enhance(contrast) # 亮度增強(qiáng) enh_bri = ImageEnhance.Brightness(img_contrasted) brightness = 2.5 image_brightened = enh_bri.enhance(brightness) #色度增強(qiáng) enh_col = ImageEnhance.Color(img) color = 50 image_colored = enh_col.enhance(color) # # 銳度增強(qiáng) 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') # 圖片漢字識(shí)別 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')
本文題目:pythonPIL模塊的基本使用-創(chuàng)新互聯(lián)
路徑分享:http://aaarwkj.com/article48/codghp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供ChatGPT、企業(yè)建站、微信小程序、云服務(wù)器、搜索引擎優(yōu)化、網(wǎng)頁(yè)設(shè)計(jì)公司
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容
全網(wǎng)營(yíng)銷(xiāo)推廣知識(shí)