1, a powerful PIL library
In Python, there is an excellent framework for image processing, is PIL library, this module will be divided Bowen describes various methods PIL library, and include relevant examples.
Study concluded: PIL library allows us to get more demand, in order to meet our psychological needs, so they can keep our confidence, there is a good condition to face life.
2, special effects show
1. generating a thumbnail function Image.thumbnail (size)
code show as below:
from PIL import Image im = Image.open("6.jpg") im.thumbnail((128,128)) im.save("6缩略图.jpg")
Original: Thumbnails:
2. The color change for each color channel using the function Image.split () to extract the RGB image, and returns a copy of the image Image.merge (mode, bands) were combined channel, which represents the color mode, the color bands Scrap represents a new channel
code show as below:
from PIL import Image im = Image.open("6.jpg") r,g,b = im.split() om = Image.merge("RGB",(b,g,r)) om.save("6改变颜色.jpg
3. changing the profile using the function ImageFilter.CONTOUR use: Image.filter (ImageFilter.fuction)
code show as below:
from the PIL Import Image from the PIL Import ImageFilter IM = Image.open ( " nest .jpg " ) OM = im.filter (ImageFilter.CONTOUR) om.save ( " nest embossed .jpg " )
4. Use relief function ImageFilter.EMBOSS
code show as below:
from PIL import Image from PIL import ImageFilter im = Image.open("6.jpg") om = im.filter(ImageFilter.EMBOSS) om.save("6浮雕.jpg")