2017年8月12日 星期六

[python] Pillow module

Install

pip install Pillow

Import

from PIL import Image

Usage

from PIL import Image
image = Image.open('Ch06/6-2節/sample_image/flower.jpg')

image.show()
from PIL import Image
image = Image.open('Ch06/6-2節/sample_image/flower.jpg')

r, g, b = image.split()
convert_image = Image.merge("RGB", (b, g, r))
convert_image.show()

convert_image.save('Ch06/6-2節/sample_image/rgb_to_bgr.jpg')
image.show()