框选图中位置

代码

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图像处理-框选的更多相关文章

  1. python PIL 图像处理操作

    python PIL 图像处理 # 导入Image库 import Image # 读取图片 im = Image.open("1234.jpg") # 显示图片 im.show( ...

  2. python PIL 图像处理

    python PIL 图像处理 This blog is from: https://www.jianshu.com/p/e8d058767dfa Image读出来的是PIL的类型,而skimage. ...

  3. python PIL 图像处理库简介(一)

    1. Introduction     PIL(Python Image Library)是python的第三方图像处理库,但是由于其强大的功能与众多的使用人数,几乎已经被认为是python官方图像处 ...

  4. python PIL图像处理库

    1. Introduction PIL(Python Image Library)是python的第三方图像处理库,但是由于其强大的功能与众多的使用人数,几乎已经被认为是python官方图像处理库了. ...

  5. python——PIL(图像处理库)

    PIL(Python Imaging Library,python图像处理库)提供了通用的图像处理功能,以及大量有用的基本图像操作,如图像缩放,裁剪,旋转,颜色转换等. 1.打开图像并显示 from ...

  6. python PIL图像处理-生成图片验证码

    生成效果如图: 代码 from PIL import Image,ImageDraw,ImageFont,ImageFilter import random # 打开一个jpg图像文件: im = I ...

  7. python PIL图像处理-图片上添加文字

    首先需要安装库pillow cmd安装命令:pip install pillow 安装完后,编写脚本如下: from PIL import Image, ImageDraw, ImageFont de ...

  8. python PIL图像处理

    新建图像 # 三个参数分别代表图像的模式:常用的为RGB(3通道) .RGBA(4通道为透明通道,0为完全透明, 256为不透明) # 第二个参数为图像的长宽参数 # 第三个为默认的填充颜色,RGB时 ...

  9. Python,PIL压缩裁剪图片

    自己写了用来压缩 DC 照片的,批量处理整目录文件,非常方便.需要安装 PIL #!/usr/bin/env python import Image import os import os.path ...

随机推荐

  1. UVA 10891 区间DP+博弈思想

    很明显带有博弈的味道.让A-B最大,由于双方都采用最佳策略,在博弈中有一个要求时,让一方的值尽量大.而且由于是序列,所以很容易想到状态dp[i][j],表示序列从i到j.结合博弈中的思想,表示初始状态 ...

  2. 全部对于Unity3D中 NGUI 触发事件的监听方法

    NGUI事件的种类非常多.比方点击.双击.拖动.滑动等等,他们处理事件的原理差点儿万全一样,本文仅仅用button来举例. 方法一.直接监听事件 把以下脚本直接绑定在button上.当button点击 ...

  3. 2018你应该了解这些.NET面试题

    2018年准备要找.NET开发相关工作的你准备好了吗,下面是小编准备的一些.NET相关的面试题,来阅读一下,也许对你有帮助哦~ 1. 谈谈你对MVC和三层架构的理解. MVC即模型.视图.控制器,模型 ...

  4. 微信小程序的小问题(1)

    1. imgUrls: [ '../../images/index/banner1.jpg', '../../images/index/banner2.jpg', '../../images/inde ...

  5. LeetCode之LCP(Longest Common Prefix)问题

    这个也是简单题目.可是关键在于题意的理解. 题目原文就一句话:Write a function to find the longest common prefix string amongst an ...

  6. LeetCode 234 Palindrome Linked List(回文链表)(*)(?)

    翻译 给定一个单链表,确定它是否是回文的. 跟进: 你能够在O(n)时间和O(1)空间下完毕它吗? 原文 Given a singly linked list, determine if it is ...

  7. Codeforces--629A--Far Relative’s Birthday Cake(暴力模拟)

    Far Relative's Birthday Cake Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d &a ...

  8. 杂项:ESB接口

    ylbtech-杂项:ESB接口 ESB全称为Enterprise Service Bus,即企业服务总线.它是传统中间件技术与XML.Web服务等技术结合的产物.ESB提供了网络中最基本的连接中枢, ...

  9. bzoj4078

    二分+2-sat 枚举第一个权值,二分第二个权值,然后2-sat检查,当第一个权值已经不能形成二分图时,再往下没意义,因为没法分成两个点集.(双指针好像跑得慢) #include<bits/st ...

  10. E20170813-ts

    explicitly  adv. 明白地,明确地;