1 parent
3800523d11
commit
cd41ab4c5e
2 files changed
+4
-4
No files matched your search
@@ -171,8 +171,8 @@ class ImageMixin(_ImageMixin):
|
||||
data = io.BytesIO()
|
||||
img = PIL.Image.open(io.BytesIO(image))
|
||||
img.thumbnail((SIZE_MAX, SIZE_MAX))
|
||||
if img.mode in {'RGBA', 'P'}:
|
||||
img.convert('RGBA')
|
||||
if img.mode != 'RGB':
|
||||
img = img.convert('RGB')
|
||||
background = PIL.Image.new('RGBA', img.size, (255, 255, 255))
|
||||
background.alpha_composite(img)
|
||||
img = background.convert('RGB')
|
||||
|
||||
@@ -128,8 +128,8 @@ class Avatar(ImageMixin, ResourceMixin, ModelSQL):
|
||||
(height + size) // 2))
|
||||
if size > 2048:
|
||||
img = img.resize((2048, 2048))
|
||||
if img.mode in {'RGBA', 'P'}:
|
||||
img.convert('RGBA')
|
||||
if img.mode != 'RGB':
|
||||
img = img.convert('RGB')
|
||||
background = Image.new('RGBA', img.size, (255, 255, 255))
|
||||
background.alpha_composite(img)
|
||||
img = background.convert('RGB')
|
||||
|
||||
Reference in new issue
Block a user