python image processing

Python library used to process images are PIL, in addition to opencv, Matplotlib, NumPy, SciPy, skimage please refer to: https://www.cnblogs.com/qiaozhoulin/p/4509954.html ,   HTTPS: //www.cnblogs .com / skyfsm / p / 8276501.html

PIL: Python Imaging Library, is already the de facto platform Python standard library of image processing. PIL is very powerful, but the API is very simple to use, but it only supports Python 2.7, create a compatible version on the basis of the PIL, called Pillow , support for the latest Python 3.x

1. Zoom papers

Image.resize () function is used to modify the size of the picture; Image.thumbnail () function is used to create a thumbnail of the current picture. from PIL import Image

= Image.open img01 ( 'F.: /pytest/101.jpeg') 
img01.show ()
W01, H01 = # img01.size obtained image size:
Print ( 'Current image01 size: the sX% S%'% (W01, H01))

img01.thumbnail ((2 // W01, H01 // 2)) #% zoom to 50:
img01.save ( 'F.: /pytest/102.jpeg', 'JPEG') # 102 is stored scaled .jpeg
img02 = Image.open ( 'F.: /pytest/102.jpeg')
img02.show ()
W02, H02 = # img02.size obtained image size:
Print ( 'Current image02 size: the sX% S%'% ( W02, H02))

#Print ( 'Resized size', img01.resize ((128,128)) size).
img03 = img01.resize ((128,128)) #t modify the image size is 128 * 128
img03.save ( 'F.: /pytest/103.jpeg','jpeg ')
img03.show ()
W03, H03 = # img03.size obtained image size:
Print (' Current image03 size: the sX% S% '% (W03, H03))

2.

Rotating articles Continued

Guess you like

Origin www.cnblogs.com/jintianniu/p/11246791.html