对于我的Python大学课程,我尝试从联机打开一个图像,以添加到另一个图像(使用Jython)。到目前为止,我的代码是:
def addLogo(lgPic):
import urllib
logo = urllib.urlopen("http://www.wsiab.net/BITsoft/Lab7/csumb-logo-white.png")
targetX = getWidth(lgPic) - getWidth(logo)
targetY = getHeight(lgPic) - getHeight(logo)
for x in range(0, getWidth(logo)):
for y in range(0, getHeight(logo)):
pix = getPixel(logo, x, y)
bPix = getPixel(lgPic, x + targetX, y + targetY)
color = getColor(pix)
bColor = getColor(bPix)
if distance(color, Color(0, 215, 0)) > 50:
newPix = getPixel(lgPic, x + targetX, y + targetY)
setColor(bPix, color)
return lgPic
这将返回错误:
getWidth(picture): Input is not a picture The error was: Inappropriate argument value (of correct type). An error occurred attempting to pass an argument to a function.
我怎么能简单地把这个图像带进来并用它工作呢?在
目前没有回答
相关问题 更多 >
编程相关推荐