0

when i try to scail picture down (( i did not have any problem )) using :
def generalscailing (picture ,pict , n ) :
# we have to pick to picture and then put them as parameter in th function :
pic=makePicture( picture )
canvas=makePicture( pict )
SourceX=0
width = getWidth(pic)
for TargetX in range(0,0+((width -0)/n)):
SourceY=0
for TargetY in range(0,0+((width -0)/n)):
px = getPixel ( pic , SourceX , SourceY)
tx = getPixel (canvas ,TargetX, TargetY )
setColor(tx,getColor(px))
SourceY = SourceY+ n
SourceX = SourceX + n
show (pic)
show (canvas)


but when i try to scail the picture up it does not work , whyyyyy ?????!!!

def generalscailing (picture ,pict , n ) :
# we have to pick to picture and then put them as parameter in th function :
pic=makePicture( picture )
canvas=makePicture( pict )
SourceX=0
width = getWidth(pic)
for TargetX in range(0,0+((width -0)*n)):
SourceY=0
for TargetY in range(0,0+((width -0)*n)):
px = getPixel ( pic , SourceX , SourceY)
tx = getPixel (canvas ,TargetX, TargetY )
setColor(tx,getColor(px))
SourceY = SourceY+ 1/n
SourceX = SourceX + 1/n
show (pic)
show (canvas)

Edited by Suzan Al-amassy: n/a

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by pyTony
0

if you are using Python2, you should use floating point in division:

+1./n

(do not use formated text in code block!)

Edited by pyTony: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.