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 5 Years Ago by Suzan Al-amassy: n/a

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

+1./n

(do not use formated text in code block!)

Edited 5 Years Ago by pyTony: n/a

This article has been dead for over six months. Start a new discussion instead.