PIL: Create one-dimensional histogram of image color lightness?

后端 未结 2 814
醉酒成梦
醉酒成梦 2021-02-03 15:49

I\'ve been working on a script, and I need it to basically:

  • Make the image greyscale (or bitonal, I will play with both to see which one works better).
  • Pr
2条回答
  •  名媛妹妹
    2021-02-03 16:43

    From the docs for PIL, histogram gives you a list of pixel counts for each pixel value in the image. If you have a grayscale image, there will be 256 different possible values, ranging from 0 to 255, and the list returned from image.histogram will have 256 entries.

提交回复
热议问题