How do I create an image in PIL using a list of RGB tuples?

前端 未结 3 675
一生所求
一生所求 2020-12-03 01:17

Suppose I have a list of pixels (represented as tuples with 3 RGB values) in a list that looks like list(im.getdata()), like this:

[(0,0,0),(255         


        
3条回答
  •  [愿得一人]
    2020-12-03 01:38

    You can do it like this:

    list_of_pixels = list(im.getdata())
    # Do something to the pixels...
    im2 = Image.new(im.mode, im.size)
    im2.putdata(list_of_pixels)
    

提交回复
热议问题