Center images in X when converting to raster

This commit is contained in:
Anton Thomasson 2020-08-22 17:37:22 +02:00
parent 12457bf54b
commit 7564408fb2

View file

@ -332,7 +332,9 @@ void ConvertWorker::convertImage(QNetworkRequest request, QString filename, QTem
QImage outImage = QImage(Width, Height, inImage.format());
outImage.fill(Qt::white);
QPainter painter(&outImage);
painter.drawImage(0, (outImage.height()-inImage.height())/2, inImage);
int xOffset = (outImage.width()-inImage.width())/2;
int yOffset = (outImage.height()-inImage.height())/2;
painter.drawImage(xOffset, yOffset, inImage);
painter.end();
if(imageFormat != "")