diff --git a/retroshare-gui/src/util/imageutil.cpp b/retroshare-gui/src/util/imageutil.cpp index c0cc2cde4..ca2716b09 100644 --- a/retroshare-gui/src/util/imageutil.cpp +++ b/retroshare-gui/src/util/imageutil.cpp @@ -64,9 +64,10 @@ bool ImageUtil::optimizeSize(QString &html, const QImage& original, QImage &opti //Downscale the image to fit into maxPixels double whratio = (qreal)original.width() / (qreal)original.height(); int maxwidth; - if(maxPixels > 0) - maxwidth = (int)sqrt((double)(maxPixels) * whratio); - else + if(maxPixels > 0) { + int maxwidth2 = (int)sqrt((double)(maxPixels) * whratio); + maxwidth = (original.width() > maxwidth2) ? maxwidth2 : original.width(); + } else maxwidth = original.width(); int minwidth = (int)sqrt(100.0 * whratio);