Commit 4f8984ad authored by Thilo Molitor's avatar Thilo Molitor

use pixbuf.new_from_bytes() instead of broken pixbuf.new_from_data()

parent 997e686d
......@@ -436,17 +436,12 @@ def get_pixbuf_from_data(file_data, want_type = False):
# try to open and convert this image to png using pillow (if available)
log.debug("loading avatar using pixbufloader directly failed, trying to convert avatar image using pillow (if available)")
pixbufloader = GdkPixbuf.PixbufLoader()
log.debug("loading avatar using pixbufloader failed, trying to convert avatar image using pillow (if available)")
avatar =
output = BytesIO(), format='PNG')
file_data = output.getvalue()
pixbuf = pixbufloader.get_pixbuf()
avatar ="RGBA")
arr =
width, height = avatar.size
pixbuf = GdkPixbuf.Pixbuf.new_from_bytes(arr, GdkPixbuf.Colorspace.RGB, True, 8, width, height, width * 4)
except:"Could not use pillow to convert avatar image, image cannot be displayed")
if want_type:
......@@ -455,7 +450,7 @@ def get_pixbuf_from_data(file_data, want_type = False):
return None
if want_type:
typ = pixbufloader.get_format().get_name()
typ = pixbufloader.get_format() and pixbufloader.get_format().get_name() or None
return pixbuf, typ
return pixbuf
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment