View Single Post
Old 11-08-2015, 03:07 PM   #14
jackie_w
Grand Sorcerer
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 6,252
Karma: 16544692
Join Date: Sep 2009
Location: UK
Device: ClaraHD, Forma, Libra2, Clara2E, LibraCol, PBTouchHD3
Actually, digging around the internet I found this. It looks a bit convoluted but it seems to work - at least for my limited needs. Is there anything neater?
Code:
data = container.raw_data(imgname)
pixmap = QPixmap()
pixmap.loadFromData(data)

... do some pixmap changes via GUI ...

pixmap.save(container.name_to_abspath(imgname))
fmt = imgname.rpartition('.')[-1].upper()
byte_array = QByteArray()
buffer = QBuffer(byte_array)
buffer.open(QIODevice.WriteOnly)
if pixmap.save(buffer, fmt):
    with container.open(imgname, 'wb') as f:
        f.write(buffer.data())
jackie_w is offline   Reply With Quote