Nov-23-2017, 02:43 PM
Hi guys, i've got a problem with my program; i want to add a square with random colors on a picture thanks to a double loop but python show me that there's a syntax error on x=x+1 and y=y+1
Can someone help me please ?
from PIL import Image
from random import randint
im1 = Image.open("lena_std.tif")
print("Les dimensions de l'image sont de",im1.size,"pixels")
print("Les valeurs du pixel à la position (10,10) sont de",im1.getpixel((10,10)))
X=206
y=206
while y<307:
while X<307:
im1.putpixel((X,y),(random.randint(0,255),random.randint(0,255),random.randint(0,255))
X = X+1
y=y+1
Can someone help me please ?
from PIL import Image
from random import randint
im1 = Image.open("lena_std.tif")
print("Les dimensions de l'image sont de",im1.size,"pixels")
print("Les valeurs du pixel à la position (10,10) sont de",im1.getpixel((10,10)))
X=206
y=206
while y<307:
while X<307:
im1.putpixel((X,y),(random.randint(0,255),random.randint(0,255),random.randint(0,255))
X = X+1
y=y+1