diff --git a/Telegram/SourceFiles/data/data_photo_media.cpp b/Telegram/SourceFiles/data/data_photo_media.cpp index 2a2a24620..312b672f5 100644 --- a/Telegram/SourceFiles/data/data_photo_media.cpp +++ b/Telegram/SourceFiles/data/data_photo_media.cpp @@ -101,6 +101,14 @@ void PhotoMedia::set( QImage image, QByteArray bytes) { const auto index = PhotoSizeIndex(size); + const auto limit = PhotoData::SideLimit(); + if (image.width() > limit || image.height() > limit) { + image = image.scaled( + limit, + limit, + Qt::KeepAspectRatio, + Qt::SmoothTransformation); + } _images[index] = PhotoImage{ .data = std::make_unique(std::move(image)), .bytes = std::move(bytes),