diff --git a/src/authority/storagehelper.cpp b/src/authority/storagehelper.cpp index 3660d5f3b72c084f51ce87084f935c8ec548d8e7..409ec17677c16d7bc37f357ddfb7de733bc0329b 100644 --- a/src/authority/storagehelper.cpp +++ b/src/authority/storagehelper.cpp @@ -159,7 +159,10 @@ compressedAvatar(const QString& image) QByteArray bArray; QBuffer buffer(&bArray); buffer.open(QIODevice::WriteOnly); - qimage.scaled({128, 128}).save(&buffer, "JPEG", 90); + + auto size = qMin(qimage.width(), qimage.height()); + auto rect = QRect((qimage.width() - size) / 2, (qimage.height() - size) / 2, size, size); + qimage.copy(rect).scaled({size, size}, Qt::KeepAspectRatio).save(&buffer, "JPEG", 90); auto b64Img = bArray.toBase64().trimmed(); return QString::fromLocal8Bit(b64Img.constData(), b64Img.length()); }