I want to take an image's data from a QLabel and then store it into a PostgreSQL Database, but I cannot store it as QPixmap, first I need to convert it into a bytes. That's what I want to know.
I've read part of the pyqt5's doc, specially the QImage and QPixmap's section but haven't seen what I am looking for.
from PyQt5 import QtWidgets, QtGui
class Widget(QtWidgets.QWidget):
def __init__(self):
super().__init__(None)
self.label = QtWidgets.QLabel(self)
self.label.setPixmap(QtGui.QPixmap("ii_e_desu_ne.jpg"))
self.setFixedSize(400,400)
self.label.setFixedSize(200, 200)
self.label.move(50, 50)
self.show()
#All is set now i want to convert the QPixmap instance's image
#into a byte string
app = QtWidgets.QApplication([])
ventana = Widget()
app.exec_()