原始图片:

范例1:

# Import library from Image

from wand.image import Image

# Import the image

with Image(filename ='../geeksforgeeks.png') as image:

# Clone the image in order to process

with image.clone() as posterize:

# Invoke posterize function

posterize.posterize(2, 'no')

# Save the image

posterize.save(filename ='posterize1.jpg')

输出:

范例2:

# Import libraries from the wand

from wand.image import Image

from wand.drawing import Drawing

from wand.color import Color

with Drawing() as draw:

# Set Stroke color the circle to black

draw.stroke_color = Color('black')

# Set Width of the circlw to 2

draw.stroke_width = 1

# Set the fill color to 'White (# FFFFFF)'

draw.fill_color = Color('white')

# Invoke Circle function with center at 50, 50 and radius 25

draw.circle((200, 200), # Center point

(100, 100)) # Perimeter point

# Set the font style

draw.font = '../Helvetica.ttf'

# Set the font size

draw.font_size = 30

with Image(width = 400, height = 400, background = Color('# 45ff33')) as pic:

# Set the text and its location

draw.text(int(pic.width / 3), int(pic.height / 2), 'GeeksForGeeks !')

# Draw the picture

draw(pic)

# Invoke posterize function method

pic.posterize(3, 'floyd_steinberg')

# Save the image

pic.save(filename ='posterize2.jpg')

输出:

python wand安装_Python Wand posterize()用法及代码示例相关推荐

  1. python cos函数_Python Tensorflow cos()用法及代码示例

    Tensorflow是Google开发的开源机器学习库.它的应用之一是开发深度神经网络. 模块tensorflow.math为许多基本的数学运算提供支持.功能tf.cos()[别名tf.math.co ...

  2. python turtle方向_Python turtle.left()用法及代码示例

    turtle 模块以面向对象和面向过程的方式提供 turtle 图形基元.由于它使用Tkinter作为基础图形,因此需要安装有Tk支持的Python版本. turtle .left() turtle. ...

  3. python json dumps 自定义_Python json.dumps()用法及代码示例

    JSON的完整形式是JavaScript Object Notation.这意味着将使用编程语言的文本组成的脚本(可执行)文件用于存储和传输数据. Python通过名为内置的软件包支持JSONjson ...

  4. python画羊_python编程羊车门问题代码示例

    问题: 有3扇关闭的门,一扇门后面停着汽车,其余门后是山羊,只有主持人知道每扇门后面是什么.参赛者可以选择一扇门,在开启它之前,主持人会开启另外一扇门,露出门后的山羊,然后允许参赛者更换自己的选择. ...

  5. python max()_Python Decimal max()用法及代码示例

    Decimal#max():max()是一个Decimal类方法,该方法比较两个Decimal值并返回两个最大值. 用法: Decimal.max() 参数: Decimal values 返回: t ...

  6. python中scale的用法_Python Decimal scaleb()用法及代码示例

    Decimal#scaleb():scaleb()是一个Decimal类方法,该方法将第二个值与其exp相加后返回第一个操作数. 用法:Decimal.scaleb() 参数:十进制值 返回:将第二个 ...

  7. python代码大全和用法用量_Python numpy.stack()用法及代码示例

    numpy.stack()函数用于沿新轴连接相同尺寸数组的序列.axis参数指定结果轴尺寸中新轴的索引.例如,如果axis = 0,它将是第一个尺寸:如果axis = -1,它将是最后的尺寸. 用法: ...

  8. python中insert()函数的用法_Python list insert()用法及代码示例

    insert()是Python中的内置函数,可将给定元素插入列表中的给定索引. 用法: list_name.insert(index, element) 参数: index - the index a ...

  9. python中shutil.copyfile的用法_Python shutil.copyfile()用法及代码示例

    Python中的Shutil模块提供了许多对文件和文件集合进行高级操作的功能.它属于Python的标准实用程序模块.此模块有助于自动执行文件和目录的复制和删除过程. shutil.copyfile() ...

最新文章

  1. 云端卫士架构师讲DDoS攻击的智能防御之道
  2. 图片裁剪功能集成优化
  3. XidianOJ 1019 自然数的秘密
  4. flutter: 根视图、根元素与根渲染
  5. Reflector反编译winform心得
  6. dictionary new一个实例_超全的Python 字典(Dictionary)介绍
  7. gun linux定义,linux gun make 入门
  8. 北京邮电大学计算机学院考研调剂,北京邮电大学计算机学院2020考研调剂缺额信息...
  9. TMS320F280049C 学习笔记21 交叉开关 Crossbar (X-BAR)
  10. 电信 IPRAN 设备组网方案_IPRAN 5G典型组网
  11. vscode安装mindmap插件之后无法打开.km文件,vscode中文版mindmap安装
  12. win10计算机删除了怎么恢复,Win10系统删除的文件怎么恢复?
  13. Android 学习资料收集 1
  14. 【Java-语言入门】开发 迷你图书管理器
  15. UI设计师就业发展前景如何?
  16. android gone动画_java – Android添加简单的动画,而setvisibility(view.Gone)
  17. 人力资源管理平台数据库
  18. Linux部署网盘(nextcloud)
  19. 谷歌浏览器打开JSP页面依然输出源代码
  20. android 实现手机录屏功能,基于MediaProjection实现Android移动手机截屏和录屏功能

热门文章

  1. Html img 标签
  2. HDU 1540 Tunnel Warfare
  3. FREE 开源 API 管理工具等
  4. CDU集训代码:输入输出训练
  5. Spring Aop面向切面编程自动注入
  6. IdentityServer4【Introduction】之支持的规范
  7. 洛谷P3763 [Tjoi2017]DNA 【后缀数组】
  8. TLS,SSL,HTTPS with Python(转)
  9. JavaScript---事件监听
  10. Android 获取外网IP,实测有效