¿Cómo convertir imágenes RAW a PNG en Python?

Tengo una carpeta que contiene más de 200raw imágenes, quiero convertirlas todas apng o cualquier otro formato, en C es bastante fácil, pero en Python no sé cómo se hace

Encontré este fragmento

#import struct
import numpy, array, PIL, Image
from struct import *

#declarations
arr1D   =   array.array('H') #H is unsigned short

#------------------------------------
#read 16 bit unsigned raw depth image
#------------------------------------
w           =   640
h           =   480
fid        =   open('/home/salman/salman/NiSimpleRead_salman/data/200.raw')
#fid         =   open('/home/salman/test.raw')
numBytes    =   w*h
arr1D.read(fid, numBytes)
fid.close()

#----------------------------------------------------
#convert to float numpy array -> scale -> uint8 array
#----------------------------------------------------
numarr = numpy.array(arr1D, dtype='float');
numarr = 255 - (numarr*255.0/numarr.max())
numarr.shape = (h,w)
numarr = numarr.astype('uint8')

#======================
#IMAGES
#======================

#2D numpy array -> image 
#-----------------------
img        =   Image.fromarray(numarr); #print data.dtype.name

#image view and save
#-------------------
#img.show()
img.save('/home/salman/test.png')

Este es el único fragmento que puedo encontrar, ¿es esta la forma correcta de hacerlo?

Respuestas a la pregunta(4)

Su respuesta a la pregunta