python 3 PIL.Imageを使って画像にスタンプを貼る
4058 ワード
from PIL import Image
import numpy
import os
path = os.getcwd()
#img = cv2.imread(path + '/Image/test_Image.png', cv2.IMREAD_GRAYSCALE)
img = Image.open(path + '/test2/resize.png') #
up_img = Image.new('L', (648, 12), 'white') # 1024, 12
down_img = Image.new('L', (648, 17), 'white') # 1024, 17
up_img.save(path + '/test2/up.png')
down_img.save(path + '/test2/down.png')
img.paste(up_img, (0, 0)) # (0,0)
img.paste(down_img, (0, 495)) #
img.save(path + '/test2/chartlet.png') #
markImg=Image.new(‘L’、(1024,12)、‘white’)