I also tried it with the original image in JPG-format, instead of lossless WebP, with a similar result.
After reading (a part of) the code, i think i understand why the avatar-image became blurry.
If i understand correctly, the avatar-images with a resolution of 512x512 that the desktop-app let me download, were actually downscaled to 341x341 (there, i think), but then (not sure where) scaled back up to 512x512.
I think if !exceeds_wh is supposed to be if exceeds_wh.
Currently it does apply additional resolution-reduction to images in JPG-format and encoded images that fit within the resolution-limit; instead of images that are larger than the limit.
The same does happen when sending an image in a chat.