趣味python教学_《趣味python》学习笔记,好玩,的,记录,贴

《好玩的python》学习记录贴1

安装好python

pip install ipython

pip install pillow

安装三方库

加载图片

from PIL import Image

hhh = Image.open(“ccc.jpg”)

hhh.show()

在这里百度了一下import和from …import 的区别,大致上是e.g.

import A

from A import B (B of A))

使用滤镜

from PIL import ImageFilter

hhh.filter(ImageFilter.CONTOUR).show()//轮廓

9b8ebf4e22165744564cbf2ce99b03ac.png

hhh.filter(ImageFilter.EMBOSS).show()//浮雕

hhh.filter(ImageFilter.BLUR).show()//模糊

hhh.filter(ImageFilter.EDGE-ENHANCE).show()//边缘增强

hhh.filter(ImageFilter.DETALL).show()//细节

hhh.filter(ImageFilter.SMOOTH).show()//平滑

hhh.filter(ImageFilter.SHARPEN).show()//锐化

剪切图片和粘贴图片

rect = 22,69,1000,1000//x,y,width,height。x,y是左上角点

eg = hhh.crop(rect)

9cd604b40b8e48053c28d52c3a051c09.png

egh=eg.filter(ImageFilter.GaussianBlur(4))//高斯模糊,半径为4

hhh.paste(egh,(22,69))

hhh.show()

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值