Skip to content

Commit 5172441

Browse files
committed
Image
1 parent ac9771e commit 5172441

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2567,9 +2567,9 @@ from PIL import Image
25672567
```python
25682568
WIDTH, HEIGHT = 100, 100
25692569
size = WIDTH * HEIGHT
2570-
pixels = [255 * i/size for i in range(size)]
2570+
hue = [255 * i/size for i in range(size)]
25712571
img = Image.new('HSV', (WIDTH, HEIGHT))
2572-
img.putdata([(int(a), 255, 255) for a in pixels])
2572+
img.putdata([(int(h), 255, 255) for h in hue])
25732573
img.convert(mode='RGB').save('test.png')
25742574
```
25752575

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2183,9 +2183,9 @@
21832183

21842184
<div><h3 id="examples">Examples</h3><div><h4 id="createsapngimageofarainbowgradient">Creates a PNG image of a rainbow gradient:</h4><pre><code class="python language-python hljs">WIDTH, HEIGHT = <span class="hljs-number">100</span>, <span class="hljs-number">100</span>
21852185
size = WIDTH * HEIGHT
2186-
pixels = [<span class="hljs-number">255</span> * i/size <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(size)]
2186+
hue = [<span class="hljs-number">255</span> * i/size <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> range(size)]
21872187
img = Image.new(<span class="hljs-string">'HSV'</span>, (WIDTH, HEIGHT))
2188-
img.putdata([(int(a), <span class="hljs-number">255</span>, <span class="hljs-number">255</span>) <span class="hljs-keyword">for</span> a <span class="hljs-keyword">in</span> pixels])
2188+
img.putdata([(int(h), <span class="hljs-number">255</span>, <span class="hljs-number">255</span>) <span class="hljs-keyword">for</span> h <span class="hljs-keyword">in</span> hue])
21892189
img.convert(mode=<span class="hljs-string">'RGB'</span>).save(<span class="hljs-string">'test.png'</span>)
21902190
</code></pre></div></div>
21912191

0 commit comments

Comments
 (0)