Use lanczos filter and optimize saved thumbnail
This commit is contained in:
parent
adeec71fac
commit
b11c9d5675
|
@ -403,14 +403,14 @@ class MatrixClient(nio.AsyncClient):
|
||||||
raise UneededThumbnail()
|
raise UneededThumbnail()
|
||||||
|
|
||||||
if not small:
|
if not small:
|
||||||
thumb.thumbnail((512, 512))
|
thumb.thumbnail((512, 512), filter=PILImage.LANCZOS)
|
||||||
|
|
||||||
with io.BytesIO() as out:
|
with io.BytesIO() as out:
|
||||||
if thumb.mode == "RGBA":
|
if thumb.mode == "RGBA":
|
||||||
thumb.save(out, "PNG")
|
thumb.save(out, "PNG", optimize=True)
|
||||||
mime = "image/png"
|
mime = "image/png"
|
||||||
else:
|
else:
|
||||||
thumb.convert("RGB").save(out, "JPEG")
|
thumb.convert("RGB").save(out, "JPEG", optimize=True)
|
||||||
mime = "image/jpeg"
|
mime = "image/jpeg"
|
||||||
|
|
||||||
content = out.getvalue()
|
content = out.getvalue()
|
||||||
|
|
|
@ -52,6 +52,7 @@ HLoader {
|
||||||
|
|
||||||
|
|
||||||
onPreviewUrlChanged: {
|
onPreviewUrlChanged: {
|
||||||
|
print( mediaUrl)
|
||||||
if (type === EventDelegate.Media.Image) {
|
if (type === EventDelegate.Media.Image) {
|
||||||
var file = "EventImage.qml"
|
var file = "EventImage.qml"
|
||||||
var props = { source: previewUrl, fullSource: mediaUrl }
|
var props = { source: previewUrl, fullSource: mediaUrl }
|
||||||
|
|
Loading…
Reference in New Issue
Block a user