Python feature notes-image processing

Source: Internet
Author: User

Python image processing
From PIL import Image
"" Open Picture "" "
Pil_im=image.open (' test1.jpg '). Convert (' L ') #打开图片, followed by function to turn gray
#print (Pil_im) #打印图片属性GF
"" "Change the image size" "
#pil_im. Thumbnail ((1000,1000)) #按比例改变图片大小 (standard with minimum value)
#pil_im =pil_im.resize ((128,128)) #不管比例强制更改图片大小
"" "Cut Picture" ""
#box = (100,100,400,400) #定义一个盒子
#region =pil_im.crop (Box) #使用定义的盒子来剪切图片
"" "Rotate Picture" ""
#region =region.transpose (image.rotate_180) #旋转180度
#pil_im =pil_im.rotate (#逆时针旋转30度)
"" Paste the picture into another picture "" "
#pil_im. Paste (Region,box)
"" Show Picture "" "
#pil_im. Show () #将图片显示出来
"" Save Picture "" "
#pil_im. Save (' newname.jpg ')

Pygraph:pip Install Python-graph-core

Install PIP:
Yum-y Install Epel-release
Yum Install Python-pip
Pip Install--upgrade pip
There may be development kits
sudo yum install Python-devel
sudo yum install Zlib-devel
sudo yum install Libjpeg-turbo-devel

wget http://labfile.oss.aliyuncs.com/courses/370/ascii.py

To install a processing package:
Pip Install Pillow

Python feature notes-image processing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.