Skip to content

feat: Use resize when resampling images with up to 2.56 megapixels#8001

Draft
72374 wants to merge 1 commit intochatmail:mainfrom
72374:better-resampling
Draft

feat: Use resize when resampling images with up to 2.56 megapixels#8001
72374 wants to merge 1 commit intochatmail:mainfrom
72374:better-resampling

Conversation

@72374
Copy link
Copy Markdown
Contributor

@72374 72374 commented Mar 16, 2026

The thumbnail-function can resample images quickly, but with very noticeable aliasing when it is used to resample images to a close resolution (~80% of the original resolution, for example). Even if the resolution-difference is large, the quality of the resampling is rather flawed. The function is for quickly resampling lots of images into tiny preview-images, for which the quality is not particularly important, and the resolution-difference is usually large (~20% of the original resolution, for example).

The amount of processing (and thus time) required to resample images, depends on the resolution of the original image.

By using the thumbnail-function only for images with a high resolution, many images will be resampled with the better resampling of the resize-function, while the processing-time, when resampling images with a high resolution, will still be relatively short.

@72374 72374 force-pushed the better-resampling branch from d8397bc to ead508e Compare April 14, 2026 22:42
@72374 72374 marked this pull request as ready for review April 14, 2026 22:43
@iequidoo
Copy link
Copy Markdown
Collaborator

Just in case, the previous discussion is at #6815

@72374
Copy link
Copy Markdown
Contributor Author

72374 commented Apr 16, 2026

One question that might be relevant for this PR:
I saw that the image-editor of Delta Chat for Android has 2 resolution-limits, and those are either higher than one or both media-quality settings in Chatmail Core.
Do those apply to the image given to Chatmail Core, or is it only for display in the editor?

If those apply to the image, that could result in downscaling twice; first by the image-editor, to 1536x1536, and then by Core, to 1280x1280, and it would also mean that the change in this PR would apply to all images edited in the Android-app, because the upper limit is 1536x1536.
If that is the case, it could be a good idea to make the limits identical, so that downscaling is only necessary once; which would improve quality and reduce processing-time. But if those should not be changed, the limit in this PR should probably be reduced to 1400x1400 or less, because otherwise this change would effectively be identical to always using bilinear-resampling for the Android-app of Delta Chat.


I set this PR back to draft, because #7822 can change what is appropriate to do in this PR. With those changes, images with a resolution of up to 1536×10661 would not be resampled, because that is a lower resolution than 1280x12802.

Footnotes

  1. 768×533 for the lower limit in the image-editor.

  2. 640x640 for the lower media-quality-setting.

@72374 72374 marked this pull request as draft April 17, 2026 01:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants