Ask coding questions

← Back to all posts
i can't change the color of my picture
GurleenSINGHKAU

i want to change a picture in grey but even with the formula, I can't do it
here my replit

from PIL import Image
Image=Image.open("pomme")
largeur,hauteur=Image.size
for x in range(largeur):
for y in range(hauteur):
R,V,B=Image.getpixel(x,y)
n-r=R299//1000
n--v=V
587//1000
n--b=B*114//1000
Image.putpixel(x,y),((n-r,n-v,n-b))
Image.save("pomme grise")

Voters
AlexandraDe4
FERNANDEZ218218
GurleenSINGHKAU
Comments
hotnewtop
Geocube101

You can convert a picture by doing...

In the case you can't load the PIL module, then...