本文整理汇总了Python中picture.Picture.setPixelGreen方法的典型用法代码示例。如果您正苦于以下问题:Python Picture.setPixelGreen方法的具体用法?Python Picture.setPixelGreen怎么用?Python Picture.setPixelGreen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类picture.Picture
的用法示例。
在下文中一共展示了Picture.setPixelGreen方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: copyImage
# 需要导入模块: from picture import Picture [as 别名]
# 或者: from picture.Picture import setPixelGreen [as 别名]
def copyImage(pic):
WIDTH = pic.getWidth()
HEIGHT = pic.getHeight()
pic2 = Picture((WIDTH, HEIGHT))
for y in range(0, HEIGHT):
for x in range(0, WIDTH):
red = pic.getPixelRed(x, y)
green = pic.getPixelGreen(x, y)
blue = pic.getPixelBlue(x, y)
pic2.setPixelRed(x, y, red)
pic2.setPixelGreen(x, y, green)
pic2.setPixelBlue(x, y, blue)
return pic2
示例2: copyImage
# 需要导入模块: from picture import Picture [as 别名]
# 或者: from picture.Picture import setPixelGreen [as 别名]
def copyImage(pic):
print (WIDTH, HEIGHT)
pic2 = Picture((WIDTH, HEIGHT))
pic2.display()
input()
for y in range(0, HEIGHT):
for x in range(0, WIDTH):
red = pic.getPixelRed(x, y)
green = pic.getPixelGreen(x, y)
blue = pic.getPixelBlue(x, y)
pic2.setPixelRed(x, y, red)
pic2.setPixelGreen(x, y, green)
pic2.setPixelBlue(x, y, blue)
return pic2