Now that the avatar can be expanded.
You can see the poor quality of the image, I understand that this is to save data, and that’s fine, but not everyone has this problem.
So I suggest that the quality of the avatar can be editable,
and an easy way to do it is through the option:
Outgoing multimedia quality.
. If it is in (balanced), the avatar will have a higher quality
. If it is in (worse quality), the avatar will be as before.
Currently avatars are 192x192. After merging this, balanced quality avatars will be 256x256 and worse quality will be 128x128, as there was also a request to reduce avatar size.
When using the desktop-version of Delta Chat, if a chosen avatar-image is larger than 10kB, it will be reduced in file-size to be no larger than 10kB with a resolution of 256x256 (while media-quality is set to “balanced”), and converted into “JPG”-format; but when the chosen image is lower than 10kB in size (and in “JPG”-format), it will be converted into “PNG”-format, with a file-size that can be larger than 50kB.
Resizing images to 256x256 and less than 10kB, with a better tool*, can result in a much better quality, but then the image will be converted to “PNG”-format by Delta Chat, which can increase the file-size by multiple times.
Can the conversion-/resizing-algorithms be switched to better ones, and/or the maximum file-size be increased to 20kB or something that works reasonably well with the currently used conversion-/resizing-algorithms?
*: For example: “jpegli”, which is available in the “XL Converter”-app, has a very good quality-to-file-size-ratio for images in “JPG”-format.
apart from that, the mentioned limits are from some years ago and no longer in place, currently it can be six times larger (512 x 512 px, 60k [1][2]), recoding was improved as well [3]. webp could help on top of that, but has challenges on its own and is not the current issue. already today, avatars set by android or iOS have a mich higher quality.
I set an avatar with the Android-version, and the quality is indeed much better, due to the higher resolution and file-size. Nice. :)
However, i noticed there are other issues with it.
I resized an image to 512x512 before choosing it as an avatar-image, so the image would not be resized by Delta Chat, but the image was much blurrier and “sharper” (lines were thickened) at the same time, after setting it as an avatar. The original format was lossless WebP.
I downloaded that avatar-image with the desktop-app by going to the profile-settings, clicking on the avatar-image to see it at a larger size, and then using the download-button offered there, to do the comparison with the actual image-file.
I tried to recreate the look of it by modifying the original image, because it neither looked like compression-artifacts nor a lower resolution, and found a way:
Applying a gaussian blur with 0.75 for both X-size and Y-size, and then “unsharp mask (sharpen)” with radius 1 and amount of 0.5 with the GNU Image Manipulation Program, made the image look very similar.
It seems that some part of the image-processing applies unnecessary filtering to the images.
things could surely be improved here and there to squeeze out some more percentages of quality. but that all is quite some effort, for comparable few impact - compared to the “much, much better” that are already done
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.