Deutsch   English   Français   Italiano  
<KeCdnfj5sqRgsyv8nZ2dnUU7983NnZ2d@giganews.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!buffer1.nntp.ams1.giganews.com!buffer2.nntp.ams1.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Sun, 12 Dec 2021 11:18:53 -0600
Newsgroups: fr.comp.lang.python
Subject: instruction niveau de gris
X-poster: PEAR::Net_NNTP v1.5.0 (stable)
From: lupusina <nospam_rosamiguel19@yahoo.fr.invalid>
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 8bit
Organization: !No_Organization!
Message-ID: <KeCdnfj5sqRgsyv8nZ2dnUU7983NnZ2d@giganews.com>
Date: Sun, 12 Dec 2021 11:18:53 -0600
Lines: 26
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-1o1S64x55U4s3HbvPuf8xAGku7b6ohOjiFkuZFwz7bYEstWSr09na0QZ1gJZLSlmuuRKFAZWPlR+94b!ugdZq81u/CWHk7e7biZRmAJ3z3Zpdzu2CzVrDo4Ou2vSsKfgXKUUkFB8o0QqtxhIgZBF+W+lWdhg
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
Bytes: 1844
X-Original-Lines: 25
X-Original-Bytes: 1729

Bonjour,
que puis-je marquer devant "moyenne=" et que dois-je compléter pour que l
nouvelle image soit en niveau de gris(mes doutes sont aux point
d'interrogation) Merci pour votre aide et vos conseils!


from PIL import Image

fichier_image = './photo.jpg'

try:
   image = Image.open(fichier_image)
except IOError:
    print ('Erreur sur ouverture du fichier ' + fichier_image)
    exit(1)

nb_colonne, nb_ligne = image.size

nouvelle_image = Image.new(image.mode,image.size)

for y in range(nb_ligne):
    for x in range(nb_colonne):
        rouge,vert,bleu = image.getpixel((x,y))
	moyenne = ??? 		 
        nouvelle_image.putpixel((x,y), (???, ???, ???))  	 

nouvelle_image.show()