1 #Import module methods in python2.x: 2 from StringIO import String 3 #In python2.x it also has a twin brother, which runs faster than it, implemented in c 4 from cStringIO import StringIO 5 #In python3. In x, StringIO is already in the io module, import method 6 from io import StringIO, BytesIO (import the corresponding module according to the written character format)
1 About Pillow and PIL 2 3 PIL (Python Imaging Library) is a powerful and convenient image processing library for Python, and its reputation is relatively large. But only supports up to Python 2.7 . 4 5 PIL official website: http://www.pythonware.com/products/pil/ 6 7 Pillow is a fork of PIL, but has now developed into a more dynamic image processing library than PIL itself. The latest version is currently 3.0.0 . 8 9 Pillow's Github homepage: https://github.com/python-pillow/ Pillow 10 Pillow's documentation (corresponding to version v3.0.0): https://pillow.readthedocs.org/en/latest/handbook/index . Chinese translation of html 11 Pillow documentation (corresponding to version v2.4.0): http://pillow-cn.readthedocs.org/en/latest/ 12 13 Python 3 .x install Pillow 14 15 Installing Pillow for Python is as simple as one line of code using pip or easy_install. 16 17 Use PIP on the command line to install: 18 pip install Pillow 19 20 Or use easy_install on the command line to install: 21 easy_install Pillow 22 23 After the installation is complete, use from PIL import Image to reference the library. For example: 24 from PIL import Image 25 im = Image.open( " bride.jpg " ) 26 im.rotate(45).show() #rotate() is the rotation angle, you can not write it, the default is 0, that is, im.show ()
*** Supplement pycharm may not be installed due to pip version or no mai file, directly cmd into the python3 installation directory, directly pip install pillow