python PIL图像处理-框选
框选图中位置
代码
from PIL import Image,ImageDraw,ImageFont,ImageFilter
import random #-------------------------------------
#filepath,[837,103][942,208] #图片处理,框选
def pic_rectangle(filepath,bound):
image = Image.open(filepath)
draw = ImageDraw.Draw(image)
# 坐标
x1, y1 =bound[0]
x2, y2 =bound[1]
# outline 外线,fill填充
draw.rectangle((x1, y1, x2, y2), outline="red", width=5)
image.save('filepath', 'jpeg')
#image.show() if __name__=="__main__":
#调用
filepath="./image/name.jpg"
bound=[[744, 276],[1014, 366]]
pic_rectangle(filepath,bound)
python PIL图像处理-框选的更多相关文章
- python PIL 图像处理操作
python PIL 图像处理 # 导入Image库 import Image # 读取图片 im = Image.open("1234.jpg") # 显示图片 im.show( ...
- python PIL 图像处理
python PIL 图像处理 This blog is from: https://www.jianshu.com/p/e8d058767dfa Image读出来的是PIL的类型,而skimage. ...
- python PIL 图像处理库简介(一)
1. Introduction PIL(Python Image Library)是python的第三方图像处理库,但是由于其强大的功能与众多的使用人数,几乎已经被认为是python官方图像处 ...
- python PIL图像处理库
1. Introduction PIL(Python Image Library)是python的第三方图像处理库,但是由于其强大的功能与众多的使用人数,几乎已经被认为是python官方图像处理库了. ...
- python——PIL(图像处理库)
PIL(Python Imaging Library,python图像处理库)提供了通用的图像处理功能,以及大量有用的基本图像操作,如图像缩放,裁剪,旋转,颜色转换等. 1.打开图像并显示 from ...
- python PIL图像处理-生成图片验证码
生成效果如图: 代码 from PIL import Image,ImageDraw,ImageFont,ImageFilter import random # 打开一个jpg图像文件: im = I ...
- python PIL图像处理-图片上添加文字
首先需要安装库pillow cmd安装命令:pip install pillow 安装完后,编写脚本如下: from PIL import Image, ImageDraw, ImageFont de ...
- python PIL图像处理
新建图像 # 三个参数分别代表图像的模式:常用的为RGB(3通道) .RGBA(4通道为透明通道,0为完全透明, 256为不透明) # 第二个参数为图像的长宽参数 # 第三个为默认的填充颜色,RGB时 ...
- Python,PIL压缩裁剪图片
自己写了用来压缩 DC 照片的,批量处理整目录文件,非常方便.需要安装 PIL #!/usr/bin/env python import Image import os import os.path ...
随机推荐
- log_archive_dest_1设置报错
DG搭建完之后,又报错: Tue Dec 22 16:24:33 2015 Errors in file /u01/app/oracle/admin/orcl/bdump/orcl_arc1_2994 ...
- jenkins配置邮箱遇到的问题
错误一:发送测试邮件测试配置没有填写接收者的邮箱 原因:没有写接收者的邮箱 2.写了接受者的邮箱 密码错误 解决办法:qq邮箱>设置>账户,发送短信后点我已发送,就会接收到密码 3.发送时 ...
- 上机题目(0基础)- 数据库事务(Java)
/* * 文件名称:JDBCTestCase.java * 版权:Copyright 2006-2011 Huawei Tech. Co. Ltd. All Rights Reserved. * 描写 ...
- hdoj--5612--Baby Ming and Matrix games(dfs)
Baby Ming and Matrix games Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K ...
- Bootstrap 只读输入框
只读输入框 为输入框设置 readonly 属性可以禁止用户输入,并且输入框的样式也是禁用状态. <input class="form-control" type=&qu ...
- [Spring] Spring Boot 生态
- Appium + python - input操作实例
import osimport time as t adb = 'adb shell input tap 400 500'os.system(adb) t.sleep(5) class keyeven ...
- UIView动画基础
1 Position 平移 [UIView animateWithDuration:1.0 animations:^{ _blueView.centerX = self.view.width -100 ...
- 取消VS2017窗口置顶
今天打开VS2017,莫名其妙窗口置顶了,百度了一下如何取消窗口置顶,就是Ctrl+Alt+Esc组合键,就可以取消窗口置顶了,至于到底怎么会突然置顶的我也不知道emmm... /********** ...
- C# 多线程系列(一)
线程是怎样工作的 1.多线程由一个线程调度器来进行内部管理,一个功能是CLR常常委托给操做系统. 一个线程调度器确保所有激活的线程在执行期间被合适的分配,等待或者阻塞的线程(比如,一个独占锁或者等待用 ...