[Python] Convert VNC RFB Frame data into Image in Python

Discussão em 'Python' iniciado por Stack, Setembro 14, 2024.

  1. Stack

    Stack Membro Participativo

    I am currently trying to take frame buffer updates from the RFB protocol (VNC Connection) and convert the 32-bit RAW's (string of byte data) into a picture using Python's Pillow or scikit-image (numpy) I can currently do it with PyQt4:

    picture = PyQt4.QtGui.QImage(width, height, PyQt4.QtGui,QImage.Format_RGB32)
    box = PyQt4.QtGui.QImage(box_w, box_h, PyQt4.QtGui,QImage.Format_RGB32)
    with PyQt4.QtGui.QPainter(picture) as qp:
    qp.drawImage(x, y, box, 0, 0, x_val, y_val)


    However, I don't want to bring in the PyQt4 library just to perform this. How can I do the same thing using either Pillow or scikit-image (w/ numpy)?

    I have tried using Image.frombuffer() using raw decoder and reading the bytes directly into a ndarray; however when I save the resulting object/array without any manipulation I can see that it didn't take in the bytes correctly.

    Continue reading...

Compartilhe esta Página