Getting list of pixel values from PIL

前端 未结 9 1129
感动是毒
感动是毒 2020-11-27 15:07

Guys, I\'m looking for a bit of assistance. I\'m a newbie programmer and one of the problems I\'m having at the minute is trying to convert a black & white .jpg

9条回答
  •  -上瘾入骨i
    2020-11-27 15:55

    pixVals = list(pilImg.getdata())
    

    output is a list of all RGB values from the picture:

    [(248, 246, 247), (246, 248, 247), (244, 248, 247), (244, 248, 247), (246, 248, 247), (248, 246, 247), (250, 246, 247), (251, 245, 247), (253, 244, 247), (254, 243, 247)]
    

提交回复
热议问题