擅长:python、mysql、java
<p>你能做这样的事吗?</p>
<pre><code>from PIL import Image
image = Image.open('image.png') #open image
image = image.convert("RGBA") #convert to RGBA
rgb = image.getpixel(x,y) #Get the rgba value at coordinates x,y
rgb[3] = int(rgb[3] / 2) or you could do rgb[3] = 50 maybe? #set alpha to half somehow
image.putpixel((x,y), rgb) #put back the modified reba values at same pixel coordinates
</code></pre>
<p>绝对不是最有效的做事方式,但它可能会起作用。我在浏览器中编写了代码,所以它可能不是无错误的,但希望它能给你一个想法。</p>
<p>编辑:刚刚注意到这个问题有多老了。把答案留给将来的帮助。:)</p>