Python Forum
random change of color pixel with PIL
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
random change of color pixel with PIL
#4
(r, g, b) = picture_1.getpixel((x,y)
You don't need color of pixel from your original picture because you dont actually use them

So altogether, with loop changed to this:
for x in range(largeur) :
    for y in range(longueur) :
        r = randint(0,25)
        g = randint(0,255)
        b = randint(0,255)
        picture_2.putpixel((x,y), (r, g, b))
it will create a new image with the same size as your original picture and every pixel will have random color.

Or is this not actually what you wanted? :D
Reply


Messages In This Thread
RE: random change of color pixel with PIL - by mlieqo - May-31-2018, 03:13 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Voxel to pixel graphics voicemail 3 634 Nov-19-2023, 09:45 AM
Last Post: paul18fr
  Turtle Star Fill Color Yellow-White Interchanging Color Effect codelab 9 1,149 Oct-25-2023, 09:09 AM
Last Post: codelab
  Pixel color and action Sartre 4 2,193 Apr-13-2023, 03:26 AM
Last Post: Sartre
  Dynamic pixel display jerryf 2 765 Mar-17-2023, 07:26 PM
Last Post: jerryf
  simplekml change shape&color issac_n 2 2,899 Aug-20-2022, 07:15 PM
Last Post: Joseph_Paintsil
  Plotting Pixel Intensity Doev 0 1,767 Oct-21-2020, 10:56 PM
Last Post: Doev
  Change the color automatically Dragonos 5 2,959 Jul-28-2020, 01:17 PM
Last Post: Dragonos
  Use of input function to change screen background color in Turtles Oldman45 3 4,992 Jul-10-2020, 09:54 AM
Last Post: Oldman45
  What is the best way to search for a pixel in a screenshot? TheZadok42 1 2,674 May-15-2020, 12:37 PM
Last Post: scidam
  Fast get pixel and oparate. storzo 7 7,246 Aug-26-2019, 07:36 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020