It should be something like:

rawData = open("foo.raw" 'rb').read()
imgSize = (x,y)
# 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.fromstring('L', imgSize, rawData, 'raw', 'F;16')
img.save("foo.png")

Using the handbook and another SO question.

The First argument is the image mode and can be any from:

  • 1 (1-bit pixels, black and white, stored with one pixel per byte)
  • L (8-bit pixels, black and white)
  • P (8-bit pixels, mapped to any other mode using a colour palette)
  • RGB (3x8-bit pixels, true colour)
  • RGBA (4x8-bit pixels, true colour with transparency mask)
  • CMYK (4x8-bit pixels, colour separation)
  • YCbCr (3x8-bit pixels, colour video format)
  • I (32-bit signed integer pixels)
  • F (32-bit floating point pixels)

how to convert raw images to png in python? - Stack Overflow

https://stackoverflow.com/questions/9922402/how-to-convert-raw-images-to-png-in-python

It should be something like: rawData = open("foo.raw" 'rb').read() imgSize = (x,y) # Use the PIL raw decoder to read the data. # the 'F;16' informs the raw ...

rawpy · PyPI

https://pypi.org/project/rawpy/

RAW image processing for Python, a wrapper for libraw. ... rawpy is an easy-to-use Python wrapper for the LibRaw library. ... DNG deflate codec, yes ...

Python raw格式图像转png格式

https://blog.csdn.net/qq_37760750/article/details/107392049

2020年7月16日 ... 先介绍两种读取raw数据为数组并将之转为png图片的方法:1、使用rawpy来读取raw数据注意raw数据有很多种不同后缀名,如:.raw、.dng、.arw等。raw数据 ...

python dng to jpg Code Example

https://www.codegrepper.com/code-examples/python/frameworks/django/python+dng+to+jpg

from PIL import Image img = Image.open('image.png') rgb_img = img.convert('RGB') rgb_img.save('image.jpg')

Python Image Converter

https://achimoraites.github.io/Python-Image-Converter/

DNG , CR2 , CRW, NEF , PEF, ERF , ORF , PPM , MOS , MRF , MRW , SRW and more!!! Personally i convert a lot of .psd , .TIF and .dng files !!! Speed. This script ...

convert jpg to png folder python Code Example

https://www.codegrepper.com/code-examples/python/convert+jpg+to+png+folder+python

rgb_img.save('image.jpg'). convert files from jpg to png and save in a new directory python. python by Nice Narwhal on Aug 21 2020 Comment.