May-31-2018, 01:00 PM
Hey !
I wrote this code to randomly change the colors pixels of an image.
The first time, it's good, pixels are randomly changed but after this, it'ls always the same image and pixels...
Can you tell me why ?
I wrote this code to randomly change the colors pixels of an image.
The first time, it's good, pixels are randomly changed but after this, it'ls always the same image and pixels...
Can you tell me why ?
from PIL import Image from random import randint picture_1 = Image.open("panda.jpg") largeur, longueur = picture_1.size print(largeur,"*",longueur) picture_2 = Image.new("RGB", (largeur, longueur)) for x in range(largeur) : for y in range(longueur) : (r, g, b) = picture_1.getpixel((x,y)) r = randint(0,25) ; v = randint(0,255) ; b = randint(0,255) picture_2.putpixel((x,y), (r, g, b)) picture_2.save("pandatest6.jpg") picture_2.show()