From 02eea3872445b72d0c16c18ab480ac7a08d2d2f7 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 16 Nov 2020 14:22:19 +0300 Subject: [PATCH] Remove color space before sending in JPG. --- Telegram/SourceFiles/storage/localimageloader.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Telegram/SourceFiles/storage/localimageloader.cpp b/Telegram/SourceFiles/storage/localimageloader.cpp index 6865d52002..0a67661e71 100644 --- a/Telegram/SourceFiles/storage/localimageloader.cpp +++ b/Telegram/SourceFiles/storage/localimageloader.cpp @@ -33,6 +33,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #include +#include namespace { @@ -878,6 +879,11 @@ void FileLoadTask::process(Args &&args) { auto medium = (w > 320 || h > 320) ? fullimage.scaled(320, 320, Qt::KeepAspectRatio, Qt::SmoothTransformation) : fullimage; auto full = (w > 1280 || h > 1280) ? fullimage.scaled(1280, 1280, Qt::KeepAspectRatio, Qt::SmoothTransformation) : fullimage; { + // We have an example of dark .png image that when being sent without + // removing its color space is displayed fine on tdesktop, but with + // a light gray background on mobile apps. + full.setColorSpace(QColorSpace()); + QBuffer buffer(&filedata); QImageWriter writer(&buffer, "JPEG"); writer.setQuality(87);