擅长:python、mysql、java
<p>我认为像so(直接从PIL <a href="http://effbot.org/imagingbook/introduction.htm" rel="nofollow noreferrer">tutorial</a>)这样的逐带基础上<code>point</code>可能更为典型:</p>
<pre><code># split the image into individual bands
source = im.split()
R, G, B = 0, 1, 2
# select regions where red is less than 100
mask = source[R].point(lambda i: i < 100 and 255)
# process the green band
out = source[G].point(lambda i: i * 0.7)
# paste the processed band back, but only where red was < 100
source[G].paste(out, None, mask)
# build a new multiband image
im = Image.merge(im.mode, source)
</code></pre>