【发布时间】:2013-03-19 14:31:32
【问题描述】:
我的目标是将图片大小翻倍然后将左半部分改为灰度,然后将右上半部分的绿色值和右下半部分的蓝色值更改。我在教科书中找到了灰度值,但我不确定这是否是我实际使用的值。而且我也不确定我是否使用 for 循环或只是使用不同的东西来编程每个不同的值
到目前为止,我的代码是:
def crazyPic(newGreen,newBlue,pic,file):
show(pic)
newPic = makeEmptyPicture(getWidth(pic)*2,getHeight((pic)*2
for x in range(width):
for y in range(height):
for px in getPixel(pic,0,100):
nRed = getRed(px) * 0.299
nGreen = getGreen(px) * 0.587
nBlue = getBlue(px) * 0.114
luminance = nRed + nGreen + nBlue
setColor(px,makeColor(luminance,luminance,luminance)
【问题讨论】:
标签: python for-loop jython jes