Suzan Al-amassy 0 Newbie Poster

Tried to add two images on each other
But the problem is because I have two images are merged in a gradual
Which means that: to show the first picture on top and clear and the second picture is not visible
Then gradually start Image Alathanih Baldhor to disappear Image the first and second picture shows quite clearly

The problem with this code
Appears as if it Image intermittent and I want it to appear gradually

def Addition (Fimage1 , Fimage2 ):
#Black
Image1 = makePicture (Fimage1)
# picture
Image2 = makePicture (Fimage2)
canvas = makeEmptyPicture(getWidth(Image1) ,getHeight(Image1))
#1
targetX = 0
for sourceX in range(0, getWidth(Image1)):
targetY = 0
for sourceY in range(0, getHeight(Image1)/5 ):
SOUpx1 = getPixel(Image1 , sourceX, sourceY)
TARpx3 = getPixel(canvas ,targetX , targetY)
color = getColor (SOUpx1)
setColor ( TARpx3 , color)
targetY = targetY + 1
targetX = targetX + 1

#2
targetX = 0
for sourceX in range(0, getWidth(Image1)):
targetY = getHeight(Image1)/5
n = 1
m = .1
for sourceY in range ( getHeight(Image1)/5 , (getHeight(Image1)/5)*2 ):
SOUpx1 = getPixel(Image1 , sourceX, sourceY)
SOUpx2 = getPixel(Image2 , sourceX, sourceY)
TARpx3 = getPixel(canvas ,targetX , targetY)
SOUpx1_R = getRed (SOUpx1)*n
SOUpx1_G = getGreen (SOUpx1)*n
SOUpx1_B = getBlue (SOUpx1)*n
SOUpx2_R = getRed (SOUpx2)*m
SOUpx2_G = getGreen (SOUpx2)*m
SOUpx2_B = getBlue (SOUpx2)*m
color = makeColor ( SOUpx1_R + SOUpx2_R , SOUpx1_G + SOUpx2_G , SOUpx1_B + SOUpx2_B )
setColor ( TARpx3 , color)
targetY = targetY + 1
n = n - .1
m = m + .1
targetX = targetX + 1

targetX = 0
for sourceX in range(0, getWidth(Image1)):
targetY = getHeight(Image1)*(4/5)
for sourceY in range(getHeight(Image1)*(4/5) ,getHeight(Image1) ):
SOUpx2 = getPixel(Image2 , sourceX, sourceY)
TARpx3 = getPixel(canvas ,targetX , targetY)
color = getColor (SOUpx2)
setColor ( TARpx3 , color)
targetY = targetY + 1
targetX = targetX + 1

show (canvas)
return canvas

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.