Getting list of pixel values from PIL

前端 未结 9 1140
感动是毒
感动是毒 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条回答
  •  温柔的废话
    2020-11-27 16:07

    As I commented above, problem seems to be the conversion from PIL internal list format to a standard python list type. I've found that Image.tostring() is much faster, and depending on your needs it might be enough. In my case, I needed to calculate the CRC32 digest of image data, and it suited fine.

    If you need to perform more complex calculations, tom10 response involving numpy might be what you need.

提交回复
热议问题