mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 23:53:58 +02:00
Remove color space before sending in JPG.
This commit is contained in:
parent
358228ce00
commit
02eea38724
1 changed files with 6 additions and 0 deletions
|
@ -33,6 +33,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#include <QtCore/QBuffer>
|
#include <QtCore/QBuffer>
|
||||||
#include <QtGui/QImageWriter>
|
#include <QtGui/QImageWriter>
|
||||||
|
#include <QtGui/QColorSpace>
|
||||||
|
|
||||||
namespace {
|
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 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;
|
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);
|
QBuffer buffer(&filedata);
|
||||||
QImageWriter writer(&buffer, "JPEG");
|
QImageWriter writer(&buffer, "JPEG");
|
||||||
writer.setQuality(87);
|
writer.setQuality(87);
|
||||||
|
|
Loading…
Add table
Reference in a new issue