-
-
Notifications
You must be signed in to change notification settings - Fork 122
Description
to send images, we scale them down to ~ 1280px width and jpg-compress them under 500k. if the image is still larger, we try over with a smaller size. avatar work similar with different constraints.
in many situations, this is a good approach, even for screenshots, refined recently a lot https://github.com/chatmail/core/pulls?q=is%3Apr+image
however, if you have a larger screenshot on desktop, with a good part of photo and another good part of text, the outgoing image looks bad.
the conversion png -> jpg is of course part of the quality loss, however needed to get images in a compatible way small at all, there were some measurements in the past, that part is really needed. done also by apple, btw.
main reason for the poor quality is the scaling down, and that by that the quality.
so, maybe do the following:
-
if an image to sent is not jpg, try first to send it with far larger dimensions, eg 4096 px. only if this gets a too large file, try over with a smaller size. this was suggested already at recode large PNG #3956, but not done that time for $reasons
-
using really the original dimensions is risky, as there are png around with eg. tens of 10000 px sides. this is also not the issue at hand
-
we should not do that approach for images that are already jpg, as this is not the issue at hand, and likely results in side effects. it will also increase overall data usage
example
eg. the following 1618 x 949 px, 1.1 mb png-image:
sending the image with Delta Chat results in a 1280 x 751 px 79 kb jpg-image:
if you convert the image in its original size to jpg, using the same 75% quality setting, which still seems to be inside the sweet spot, it is far better - while being 114 kb only:
sure, that specific image can be improved further. but goal is to have an overall, simple approach, that does not make all images larger that would not need it.

