Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
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.
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) :
mixingLevels= x /(float(w-1)) # I totally mess things up here
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 )
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!!!
0 · ·