TypeError: memoryview: a bytes-like object is required, not ‘JpegImageFile’ in python 3.5

Hello I’m having trouble on how to fix this error can anyone knows how to fix this error. here is my snippet code.

def save(self): self.filePath, _ = QFileDialog.getOpenFileName(self, "Open File ", "", "JPEG(*.JPEG *.jpeg *.JPG *.jpg)") img =Image.open(self.filePath) conn.execute("INSERT INTO DriverInfo(driverImg)VALUES(?)", repr(memoryview(img))) conn.commit()

Thank you in advance.