PIL图像处理(3)

pillow的像素索引

 

 单像素操作

 

 

pillow区域操作

# 对图像一个区域的操作转化为对这个区域的每个像素进行操作
box = (100, 100, 400, 400)
region = im.crop(box)
region = region.point(lambda x:x+100)
im.paste(region, box)
im.show()

pillow中paste操作

 pillow掩模操作

If a mask is given, this method updates only the regions indicated by the mask. You can use either “1”, “L” or “RGBA” images (in the latter case, the alpha band is used as mask). Where the mask is 255, the given image is copied as is. Where the mask is 0, the current value is preserved. Intermediate values will mix the two images together, including their alpha channels if they have them.

pillow通道操作

 

 

 

pillow颜色转换

 

pillow中palette操作