I could use some help with my python program. Pretty PLease!!??

ok so this need to be a program that take to pictures ( that are the same size ) and slowly fades the two into a newPic. this is what i have so far, but i am having major issues. I am totally new with programming and we are using JES.
[code]def main():
showInformation( "Pick two pictures of the same size." )
pic1= makePicture( pickAFile() )
pic2= makePicture( pickAFile() )

w=getWidth( pic1 )
h=getHeight( pic1 )
assert w == getWidth( pic2 )
assert h == getHeight( pic2 )
newPic= makeEmptyPicture( w,h )

printNow( "working..." )
for x in range (0,w) :
for y in range (0,w) :

totalRed= 0
totalGreen= 0
totalBlue=0
mixingLevels= x /(float(w-1)) # I totally mess things up here
int( mixingLevels*
for mixingLevels in range( 0, w-1 ):
px= getPixel( pic1, 1-mixingLevels, y)
totalRed= totalRed + getRed( px )
totalGreen= totalGreen + getGreen( px )
totalBlue= totalBlue + getBlue( px )

avgRed= totalRed / (w - 1)
avgGreen= totalGreen / (w - 1)
avgBlue= totalBlue / (w - 1)

#px1= getPixel( pic1, x, y )
#px2= getPixel( pic2, x, y )
pxNew= getPixel( newPic, x, y )
setRed( pxNew, avgRed )
setBlue( pxNew, avgBlue )
setGreen( pxNew, avgGreen )

printNow( "...done" )
show( newPic )
[/code]

I think that i need to use a function called crossfade. here is a bit more info about the program, mixingLevel= x/ float(w-1) and int( mixingLevel*r2 + (1-mixingLevel) * r1) where r1 and r2 and the red levels from both picture.

please please please help!!!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories