def makePng(img):
 io = QtCore.QBuffer()
 qim = fn.makeQImage(img.transpose(1, 0, 2), alpha=False)
 qim.save(io, 'PNG')
 png = bytes(io.data().data())
 return png

def makePng ( img ) : io = QtCore . QBuffer ( ) qim = fn . makeQImage ( img . transpose ( 1 , 0 , 2 ) , alpha = False ) qim . save ( io , 'PNG' ) png = bytes ( io . data ( ) . data ( ) ) return png
given an array like .