1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > raw格式的图像转为可以查看的png格式

raw格式的图像转为可以查看的png格式

时间:2023-02-25 09:41:36

相关推荐

raw格式的图像转为可以查看的png格式

将raw格式的图像转为可以查看的png格式:

# coding:utf-8from PIL import ImagerawData = open('Color_74.raw','rb').read()imgSize = (640,480) ###The size of the image# Use the PIL raw decoder to read the data.# the 'F;16' informs the raw decoder that we are reading# a little endian, unsigned integer 16 bit data.img = Image.frombytes('RGB', imgSize, rawData, 'raw')img.save("foo.png")

需要预先知道图像的尺寸,还有图像的格式,是RGB还是灰度图像等。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。