def pixmap_to_data(pixmap, format='JPEG', quality=90):
 ba = QByteArray()
 buf = QBuffer(ba)
 buf.open(QBuffer.WriteOnly)
 pixmap.save(buf, format, quality=quality)
 return bytes(ba.data())

def pixmap_to_data ( pixmap , format = 'JPEG' , quality = 90 ) : ba = QByteArray ( ) buf = QBuffer ( ba ) buf . open ( QBuffer . WriteOnly ) pixmap . save ( buf , format , quality = quality ) return bytes ( ba . data ( ) )
return the qpixmap pixmap as a string saved in the specified format .