import os
import PIL
from PIL import Image
from PIL import ImageFilter
if __name__ == '__main__':
image1 = Image.open("test.jpg")
image2 = Image.open("logo.bmp")
print(image1.format, image1.size, image1.mode) #BMP (650, 328) RGB
print(image2.format, image2.size, image2.mode)
image1filter = image1.filter(ImageFilter.CONTOUR) #filter中的参数检测边缘
image2filter = image2.filter(ImageFilter.CONTOUR)
image3 = image1.rotate(180)
#image2filter.show()
#image1filter.show()
image1filter.save('image1filter.png')
image2filter.save('image1filter.png')
image3.save('rotate.png')
print('边缘检测图片保存成功')
newimage = Image.blend(image1, image3, 0.5)
newimage.show()
newimage.save('newimage.png')