flask pillow图片处理(flask 79)

抓屏

!/usr/local/bin/python

from PIL import ImageGrab

get current screen copy

image = ImageGrab.grab()

display image size

print("Current screen shot size :",image.size)

display image mode

print("Screen shot picture mode :", image.mode)

save picture to /tmp/screen-grab-1.bmp

image.save('/tmp/screen-grab-1.bmp')

show picture

image.show()

滤镜

from PIL import ImageFilter, Image

src_image = Image.open('/tmp/screen-grab-1.bmp')

print("begin to filter the pic")

dst_image = src_image.filter(ImageFilter.CONTOUR)

print("picture through filter")

dst_image.show()

旋转

from PIL import Image

src_image = Image.open('/tmp/screen-grab-1.bmp')

print("begin to rotate the pic")

dst_image = src_image.rotate(90)

print("picture after rotating")

dst_image.show()

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

发表于

我来说两句

0 条评论
登录 后参与评论

扫码关注云+社区

领取腾讯云代金券