画像の幅を 1 ピクセル増やすプログラムを実装しようとしています。次に、新しい最大 x 縦座標を取得し、これをランダムな y 縦座標 (画像の範囲内) に配置して、新しいピクセルを作成します。
for x in range (0,getWidth(pic)):
for y in range (0,getHeight(pic)):
X=getWidth(pic)
newX = (X+1)
colr=(255,0,0)
newPixel = getPixel (pic, newX, y)//line 25
setColor(newPixel, colr)
Y=getHeight(pic)
newY= (Y+1)
newPixel = getPixel( pic,x, newY)
setColor(newPixel, colr)
次のエラーが表示されます。
getPixel(picture,x,y): x (= 226) is less than 0 or bigger than the width (= 224)
The error was:
Inappropriate argument value (of correct type).
An error occurred attempting to pass an argument to a function.
Please check line 25 of D:\bla bla
範囲外なのはわかります。私は何を間違っていますか?