|
|
@ -2280,7 +2280,7 @@ img.convert(<span class="hljs-string">'RGB'</span>).save(<span class="hljs-strin |
|
|
|
add_noise = <span class="hljs-keyword">lambda</span> value: max(<span class="hljs-number">0</span>, min(<span class="hljs-number">255</span>, value + randint(<span class="hljs-number">-20</span>, <span class="hljs-number">20</span>))) |
|
|
|
img = Image.open(<span class="hljs-string">'test.png'</span>).convert(<span class="hljs-string">'HSV'</span>) |
|
|
|
img.putdata([(add_noise(h), s, v) <span class="hljs-keyword">for</span> h, s, v <span class="hljs-keyword">in</span> img.getdata()]) |
|
|
|
img.convert(<span class="hljs-string">'RGB'</span>).save(<span class="hljs-string">'test.png'</span>) |
|
|
|
img.show() |
|
|
|
</code></pre></div> |
|
|
|
|
|
|
|
<div><h3 id="imagedraw">Image Draw</h3><pre><code class="python language-python hljs"><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> ImageDraw |
|
|
|