[Python] python通过pil模块将raw图片转换成png图片 →→→→→进入此内容的聊天室

来自 , 2020-01-06, 写在 Python, 查看 154 次.
URL http://www.code666.cn/view/b73bade9
  1. rawData = open("foo.raw" 'rb').read()
  2. # http://www.sharejs.com
  3. imgSize = (x,y)
  4. # Use the PIL raw decoder to read the data.
  5. # the 'F;16' informs the raw decoder that we are reading
  6. # a little endian, unsigned integer 16 bit data.
  7. img = Image.fromstring('L', imgSize, rawData, 'raw', 'F;16')
  8. img.save("foo.png")
  9.  
  10.  
  11. #//python/8728

回复 "python通过pil模块将raw图片转换成png图片"

这儿你可以回复上面这条便签

captcha