2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-02 07:25:46 +00:00

Implement lossless jpeg progression

This commit is contained in:
Ilya Fedin
2023-01-09 04:19:59 +04:00
committed by John Preston
parent 5f93725431
commit ce37c6ef08
2 changed files with 10 additions and 4 deletions

View File

@@ -183,9 +183,15 @@ struct PreparedFileThumbnail {
if (!bytes.isEmpty() if (!bytes.isEmpty()
&& (bytes.size() && (bytes.size()
<= full.width() * full.height() * kRecompressAfterBpp / 8) <= full.width() * full.height() * kRecompressAfterBpp / 8)
&& (format == u"jpeg"_q) && (format == u"jpeg"_q)) {
&& Images::IsProgressiveJpeg(bytes)) { if (!Images::IsProgressiveJpeg(bytes)) {
return bytes; if (const auto result = Images::MakeProgressiveJpeg(bytes)
; !result.isEmpty()) {
return result;
}
} else {
return bytes;
}
} }
auto result = QByteArray(); auto result = QByteArray();