From 093bf7c1a11be7c1c523b1432a5663e4845d9c55 Mon Sep 17 00:00:00 2001 From: Robin Townsend Date: Wed, 2 Nov 2022 23:12:43 -0400 Subject: [PATCH] Fix blurry avatars --- src/matrix-utils.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/matrix-utils.ts b/src/matrix-utils.ts index 796b8229..95739a4b 100644 --- a/src/matrix-utils.ts +++ b/src/matrix-utils.ts @@ -309,5 +309,7 @@ export function getAvatarUrl( ): string { const width = Math.floor(avatarSize * window.devicePixelRatio); const height = Math.floor(avatarSize * window.devicePixelRatio); - return mxcUrl && client.mxcUrlToHttp(mxcUrl, width, height, "crop"); + // scale is more suitable for larger sizes + const resizeMethod = avatarSize <= 96 ? "crop" : "scale"; + return mxcUrl && client.mxcUrlToHttp(mxcUrl, width, height, resizeMethod)!; }