Python Imaging Library: ImagePalette Module(图像调色板模块)

FIXME: 这个部分不太符合当前现状。现在,将调色板添加到图像的最安全的方法是在字符串中使用调色板数据。

Examples:将调色板添加到图像中 (序列语法,Sequence Syntax)

palette = []
for i in range(256):
    palette.extend((i, i, i)) # grayscale wedge
assert len(palette) == 768
im.putpalette(palette)

Examples:将调色板添加到图像中 (未支持)

import ImagePalette
palette = ImagePalette.ImagePalette("RGB")
palette.putdata(...)
im.putpalette(palette)

Examples:使用Resize/Convert获取调色板内容

assert im.mode == "P"
lut = im.resize((256, 1))
lut.putdata(range(256))
lut = lut.convert("RGB").getdata()
# lut now contains a sequence of (r, g, b) tuples

Classes

ImagePalette

ImagePalette.ImagePalette(mode=”RGB”) ⇒ palette instance

这个构造函数创建一个新的调色板,从“P”映射到给定的模式。

调色板被初始化到一个线性的灰度渐变。

Python Imaging Library: ImagePalette Module(图像调色板模块)相关推荐

  1. Python Imaging Library: ImageFile Module(图像文件模块)

    Python Imaging Library: ImageFile Module(图像文件模块) ImageFile模块为图像打开和保存功能提供了支持函数. 此外,它还提供了一个解析器类,可以被用来对 ...

  2. Python Imaging Library: ImageEnhance Module(图像增强模块)

    Python Imaging Library: ImageEnhance Module(图像增强模块) # 图像增强模块(ImageEnhance Module) PilImg_Enhance = I ...

  3. Python Imaging Library: ImageSequence Module(图像序列模块)

    Python Imaging Library: ImageSequence Module(图像序列模块) ImageSequence模块包含一个包装器类,可以让您遍历图像序列中的所有帧. Functi ...

  4. Python Imaging Library: ImageWin Module(图像Windows模块)

    Python Imaging Library: ImageWin Module(图像Windows模块) ImageWin模块支持在Windows上创建和显示图像. ImageWin可以与Python ...

  5. Python Imaging Library: ImageTk Module(图像Tkinter模块)

    Python Imaging Library: ImageTk Module(图像Tkinter模块) ImageTk模块支持从图片中创建和修改Tkinter位图图像和PhotoImage对象. 例如 ...

  6. Python Imaging Library: ImageQt Module(图像QT模块)

    Python Imaging Library: ImageQt Module(图像QT模块) (版本1.1.6) ImageQt 模块支持从图片中创建PyQt4 QImage对象. 注意:如果你使用的 ...

  7. Python Imaging Library: ImagePath Module(图像路径模块)

    Python Imaging Library: ImagePath Module(图像路径模块) ImagePath模块用于存储和操作二维向量数据.路径对象可以在 ImageDraw 模块中传递方法. ...

  8. Python Imaging Library: ImageOps Module(图像运算模块)

    Python Imaging Library: ImageOps Module(图像运算模块) (版本1.1.3) ImageOps模块包含许多"现成的"图像处理操作.这个模块是实 ...

  9. Python Imaging Library: ImageMath Module(图像数学运算模块)

    Python Imaging Library: ImageMath Module(图像数学运算模块) (新版本1.1.6)可以使用ImageMath模块来评估"图像表达式".这个模 ...

最新文章

  1. UVa 1339,紫书P73,词频
  2. python里面temp是啥-Python tempfile模块学习笔记(临时文件)
  3. 虚拟机登陆别的服务器吗,云服务器只能用虚拟机登录吗
  4. python工作目录_如何使用python 3获取当前工作目录?
  5. vue --- 使用component的 :is属性切换标签页
  6. Django复习:视图和模版
  7. go json tag 字符串 整数_json:你或许还不知道的序列化操作(一)
  8. Matlab中bsxfun和unique函数解析
  9. 微软Azure Services Bus中的工作流
  10. xe android 联系人,Delphi XE 开发android后台服务例程
  11. C/C++基础学习代码(1)
  12. 《数学建模与数学实验》第5版 线性规划 习题3.4
  13. 计算机软考网络工程师视频资料,计算机软考网络工程师视频教程
  14. SSM框架整合(Spring+SpringMVC+MyBatis)附源码
  15. 在CENTOS 7上安装SNIPE-IT进行资产管理
  16. 曼哈顿算法公式_Manhattan Distance Calculation(曼哈顿距离算法)
  17. springboot设置运行内存_spring boot应用优化,6s内启动,内存减半
  18. 移远EC25-xxx国外支持列表
  19. Zrlog开源博客网站 安装教程
  20. 【日拱一卒行而不辍20220926】自制操作系统

热门文章

  1. oracle-只读数据文件的备份与恢复
  2. 《java入门如此简单》——基础知识1
  3. 读《我是一只 IT 小小鸟》
  4. Win10 iot 配置防火墙限制应用部署
  5. iOS 10 推送的简单使用
  6. Splay_Tree 模板(区间修改,旋转操作)
  7. nfs挂载出错:mount.nfs: access denied by server while mounting
  8. php缓存静态化设计,PHP使用OB缓存实现静态化功能示例
  9. dubbo注册中心介绍
  10. JS魔法堂:那些困扰你的DOM集合类型