当前位置: 移动技术网 > IT编程>脚本编程>Python > Python PIL图像颜色模块ImageColor Module的讲解

Python PIL图像颜色模块ImageColor Module的讲解

2018年03月24日  | 移动技术网IT编程  | 我要评论

dnf范弗拉丁的自白书怎么得,众彩网首页,脚浮肿的原因

Python PIL图像颜色模块:ImageColor Module的讲解

图像颜色模块(ImageColorModule)支持的字符串格式如下:

十六进制(Hexadecimal )颜色说明符,如“#rgb”或“#rrggbb”。例如,“#ff0000”表示纯红色。

RGB函数,如“rgb(red, green, blue)” ,其中颜色值取值范围为【0-255】的整数。作为另外一种选择,也可以使用百分比(0%-100%)。例如“rgb(255,0,0)”“rgb(100%,0%,0%)”都表示纯红色。

Hue-Saturation-Lightness (HSL)函数,如“hsl(hue, saturation%, lightness%)” ,色度(Hue)取值范围为【0-360】(red=0, green=120, blue=240),饱和度(Saturation)取值范围为【0%-100%】 (gray=0%, full color=100%),亮度(lightness)取值范围为【0%-100%】 (black=0%, normal=50%, white=100%)。例如“hsl(0,100%,50%)”表示纯红色。

通用HTML颜色名称。图像颜色模块(ImageColorModule)支持140种标准颜色名称,包含基于X窗口系统和大多数web浏览器支持的颜色。颜色名称不区分大小写。例如“red”and“Red”都表示纯红色。

函数

getrgb(color)? (red, green, blue)

(New in 1.1.4) Convert a colour string to an RGB tuple. If the string cannot be parsed, this function raises aValueErrorexception.

getcolor(color, mode)? (red, green, blue) or integer

(New in 1.1.4) Same asgetrgb, but converts the RGB value to a greyscale value if the mode is not color or a palette image. If the string cannot be parsed, this function raises aValueErrorexception.

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网