【发布时间】:2018-04-08 12:31:57
【问题描述】:
我正在尝试创建一个 4 像素的图像:
1 个红色像素, 1个蓝色像素, 1个绿色像素, 1像素白色
代码:
import wand.image
red = wand.image.Color('rgb(255,0,0)')
green = wand.image.Color('rgb(0,255,0)')
blue = wand.image.Color('rgb(0,0,255)')
white = wand.image.Color('rgb(255,255,255)')
myImage = wand.image.Image(width=2,height=2)
with wand.image.Image (myImage) as img:
img[0][0] = red
img[0][1] = blue
img[1][0] = green
img[1][1] = white
img.save(filename='out.png')
但它只会创建一个透明的png。我究竟做错了什么?
【问题讨论】: