Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v8plus / html / python / lib / module-colorsys.html
CommitLineData
920dae64
AT
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html>
3<head>
4<link rel="STYLESHEET" href="lib.css" type='text/css' />
5<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
6<link rel='start' href='../index.html' title='Python Documentation Index' />
7<link rel="first" href="lib.html" title='Python Library Reference' />
8<link rel='contents' href='contents.html' title="Contents" />
9<link rel='index' href='genindex.html' title='Index' />
10<link rel='last' href='about.html' title='About this document...' />
11<link rel='help' href='about.html' title='About this document...' />
12<link rel="next" href="module-rgbimg.html" />
13<link rel="prev" href="module-chunk.html" />
14<link rel="parent" href="mmedia.html" />
15<link rel="next" href="module-rgbimg.html" />
16<meta name='aesop' content='information' />
17<title>14.7 colorsys -- Conversions between color systems</title>
18</head>
19<body>
20<DIV CLASS="navigation">
21<div id='top-navigation-panel' xml:id='top-navigation-panel'>
22<table align="center" width="100%" cellpadding="0" cellspacing="2">
23<tr>
24<td class='online-navigation'><a rel="prev" title="14.6 chunk "
25 href="module-chunk.html"><img src='../icons/previous.png'
26 border='0' height='32' alt='Previous Page' width='32' /></A></td>
27<td class='online-navigation'><a rel="parent" title="14. Multimedia Services"
28 href="mmedia.html"><img src='../icons/up.png'
29 border='0' height='32' alt='Up One Level' width='32' /></A></td>
30<td class='online-navigation'><a rel="next" title="14.8 rgbimg "
31 href="module-rgbimg.html"><img src='../icons/next.png'
32 border='0' height='32' alt='Next Page' width='32' /></A></td>
33<td align="center" width="100%">Python Library Reference</td>
34<td class='online-navigation'><a rel="contents" title="Table of Contents"
35 href="contents.html"><img src='../icons/contents.png'
36 border='0' height='32' alt='Contents' width='32' /></A></td>
37<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
38 border='0' height='32' alt='Module Index' width='32' /></a></td>
39<td class='online-navigation'><a rel="index" title="Index"
40 href="genindex.html"><img src='../icons/index.png'
41 border='0' height='32' alt='Index' width='32' /></A></td>
42</tr></table>
43<div class='online-navigation'>
44<b class="navlabel">Previous:</b>
45<a class="sectref" rel="prev" href="module-chunk.html">14.6 chunk </A>
46<b class="navlabel">Up:</b>
47<a class="sectref" rel="parent" href="mmedia.html">14. Multimedia Services</A>
48<b class="navlabel">Next:</b>
49<a class="sectref" rel="next" href="module-rgbimg.html">14.8 rgbimg </A>
50</div>
51<hr /></div>
52</DIV>
53<!--End of Navigation Panel-->
54
55<H1><A NAME="SECTION0016700000000000000000">
5614.7 <tt class="module">colorsys</tt> --
57 Conversions between color systems</A>
58</H1>
59
60<P>
61<A NAME="module-colorsys"></A>
62
63<P>
64The <tt class="module">colorsys</tt> module defines bidirectional conversions of
65color values between colors expressed in the RGB (Red Green Blue)
66color space used in computer monitors and three other coordinate
67systems: YIQ, HLS (Hue Lightness Saturation) and HSV (Hue Saturation
68Value). Coordinates in all of these color spaces are floating point
69values. In the YIQ space, the Y coordinate is between 0 and 1, but
70the I and Q coordinates can be positive or negative. In all other
71spaces, the coordinates are all between 0 and 1.
72
73<P>
74More information about color spaces can be found at
75<a class="url" href="http://www.poynton.com/ColorFAQ.html">http://www.poynton.com/ColorFAQ.html</a>.
76
77<P>
78The <tt class="module">colorsys</tt> module defines the following functions:
79
80<P>
81<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
82 <td><nobr><b><tt id='l2h-4749' xml:id='l2h-4749' class="function">rgb_to_yiq</tt></b>(</nobr></td>
83 <td><var>r, g, b</var>)</td></tr></table></dt>
84<dd>
85Convert the color from RGB coordinates to YIQ coordinates.
86</dl>
87
88<P>
89<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
90 <td><nobr><b><tt id='l2h-4750' xml:id='l2h-4750' class="function">yiq_to_rgb</tt></b>(</nobr></td>
91 <td><var>y, i, q</var>)</td></tr></table></dt>
92<dd>
93Convert the color from YIQ coordinates to RGB coordinates.
94</dl>
95
96<P>
97<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
98 <td><nobr><b><tt id='l2h-4751' xml:id='l2h-4751' class="function">rgb_to_hls</tt></b>(</nobr></td>
99 <td><var>r, g, b</var>)</td></tr></table></dt>
100<dd>
101Convert the color from RGB coordinates to HLS coordinates.
102</dl>
103
104<P>
105<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
106 <td><nobr><b><tt id='l2h-4752' xml:id='l2h-4752' class="function">hls_to_rgb</tt></b>(</nobr></td>
107 <td><var>h, l, s</var>)</td></tr></table></dt>
108<dd>
109Convert the color from HLS coordinates to RGB coordinates.
110</dl>
111
112<P>
113<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
114 <td><nobr><b><tt id='l2h-4753' xml:id='l2h-4753' class="function">rgb_to_hsv</tt></b>(</nobr></td>
115 <td><var>r, g, b</var>)</td></tr></table></dt>
116<dd>
117Convert the color from RGB coordinates to HSV coordinates.
118</dl>
119
120<P>
121<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
122 <td><nobr><b><tt id='l2h-4754' xml:id='l2h-4754' class="function">hsv_to_rgb</tt></b>(</nobr></td>
123 <td><var>h, s, v</var>)</td></tr></table></dt>
124<dd>
125Convert the color from HSV coordinates to RGB coordinates.
126</dl>
127
128<P>
129Example:
130
131<P>
132<div class="verbatim"><pre>
133&gt;&gt;&gt; import colorsys
134&gt;&gt;&gt; colorsys.rgb_to_hsv(.3, .4, .2)
135(0.25, 0.5, 0.4)
136&gt;&gt;&gt; colorsys.hsv_to_rgb(0.25, 0.5, 0.4)
137(0.3, 0.4, 0.2)
138</pre></div>
139
140<DIV CLASS="navigation">
141<div class='online-navigation'>
142<p></p><hr />
143<table align="center" width="100%" cellpadding="0" cellspacing="2">
144<tr>
145<td class='online-navigation'><a rel="prev" title="14.6 chunk "
146 href="module-chunk.html"><img src='../icons/previous.png'
147 border='0' height='32' alt='Previous Page' width='32' /></A></td>
148<td class='online-navigation'><a rel="parent" title="14. Multimedia Services"
149 href="mmedia.html"><img src='../icons/up.png'
150 border='0' height='32' alt='Up One Level' width='32' /></A></td>
151<td class='online-navigation'><a rel="next" title="14.8 rgbimg "
152 href="module-rgbimg.html"><img src='../icons/next.png'
153 border='0' height='32' alt='Next Page' width='32' /></A></td>
154<td align="center" width="100%">Python Library Reference</td>
155<td class='online-navigation'><a rel="contents" title="Table of Contents"
156 href="contents.html"><img src='../icons/contents.png'
157 border='0' height='32' alt='Contents' width='32' /></A></td>
158<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
159 border='0' height='32' alt='Module Index' width='32' /></a></td>
160<td class='online-navigation'><a rel="index" title="Index"
161 href="genindex.html"><img src='../icons/index.png'
162 border='0' height='32' alt='Index' width='32' /></A></td>
163</tr></table>
164<div class='online-navigation'>
165<b class="navlabel">Previous:</b>
166<a class="sectref" rel="prev" href="module-chunk.html">14.6 chunk </A>
167<b class="navlabel">Up:</b>
168<a class="sectref" rel="parent" href="mmedia.html">14. Multimedia Services</A>
169<b class="navlabel">Next:</b>
170<a class="sectref" rel="next" href="module-rgbimg.html">14.8 rgbimg </A>
171</div>
172</div>
173<hr />
174<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
175</DIV>
176<!--End of Navigation Panel-->
177<ADDRESS>
178See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
179</ADDRESS>
180</BODY>
181</HTML>