這篇文章主要介紹了python Pillow圖像處理方法匯總,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下
Pillow中文文檔:https://pillow-cn.readthedocs.io/zh_CN/latest/handbook/tutorial.html
安裝:pip install pillow
操作圖像:
#!/usr/bin/env python3 # _*_ coding utf-8 _*_ __author__ = 'nxz' from PIL import Image, ImageFilter from time import sleep # 打開一個jpg圖像文件 im = Image.open('test.jpg') w, h = im.size # print('圖片的寬:%s,和高:%s' % (w, h)) # 圖片縮放 im.thumbnail((w // 2, h // 2)) w, h = im.size print(w, h) # 縮放之后的圖片重新保存 im.save('thumbnail.jpg', 'jpeg') # 其他功能:切片、旋轉(zhuǎn)、濾鏡、輸出文字、調(diào)色板 # 模糊效果 im2 = im.filter(ImageFilter.BLUR) im2.save('blur.jpg','jpeg')
名稱欄目:pythonPillow圖像處理方法匯總-創(chuàng)新互聯(lián)
網(wǎng)站路徑:http://aaarwkj.com/article42/dpgpec.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站導(dǎo)航、建站公司、關(guān)鍵詞優(yōu)化、云服務(wù)器、網(wǎng)站改版、網(wǎng)站設(shè)計公司
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容