Answers for "Qt convert image to base64"

0

Qt convert image to base64

# Python Solution
# The PIL Module has a class that helps with this.
from PIL.ImageQt import ImageQt

image = PySide2.QtGui.QPixmap.toImage()
image = ImageQt(image)
# Now you have an object with PIL + Qt support.
import base64
from io import BytesIO

buffered = BytesIO()
image.save(buffered, format="JPEG")
img_str = base64.b64encode(buffered.getvalue())
Posted by: Guest on June-11-2020

Code answers related to "Qt convert image to base64"

Python Answers by Framework

Browse Popular Code Answers by Language