How do I make the pasted image clear?
-
I created a save plot and want to put a logo in a predetermined position but after the logo is pasted the logo becomes broken or blurred, what should be done?
int logoHeight = 30; QSize plotSize = ui->customPlot->size(); QSize imageSize(plotSize.width(), plotSize.height() + logoHeight); QImage image(imageSize, QImage::Format_ARGB32); image.fill(Qt::white); QPainter painter(&image); ui->customPlot->setGeometry(0, logoHeight, plotSize.width(), plotSize.height()); ui->customPlot->render(&painter); QString LogoGraph = (setLogoGp != "None") ? setLogoGp : ":/img/Logo.png"; QPixmap logo(LogoGraph); if (!logo.isNull()) { int logoWidth = 150; int logoHeight = 25; QPixmap scaledLogo = logo.scaled(logoWidth, logoHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation); int x = 50; int y = imageSize.height() - logoHeight - 5; painter.drawPixmap(QRect(x, y, logoWidth, logoHeight), scaledLogo); } image.save(fileName); -
I created a save plot and want to put a logo in a predetermined position but after the logo is pasted the logo becomes broken or blurred, what should be done?
int logoHeight = 30; QSize plotSize = ui->customPlot->size(); QSize imageSize(plotSize.width(), plotSize.height() + logoHeight); QImage image(imageSize, QImage::Format_ARGB32); image.fill(Qt::white); QPainter painter(&image); ui->customPlot->setGeometry(0, logoHeight, plotSize.width(), plotSize.height()); ui->customPlot->render(&painter); QString LogoGraph = (setLogoGp != "None") ? setLogoGp : ":/img/Logo.png"; QPixmap logo(LogoGraph); if (!logo.isNull()) { int logoWidth = 150; int logoHeight = 25; QPixmap scaledLogo = logo.scaled(logoWidth, logoHeight, Qt::KeepAspectRatio, Qt::SmoothTransformation); int x = 50; int y = imageSize.height() - logoHeight - 5; painter.drawPixmap(QRect(x, y, logoWidth, logoHeight), scaledLogo); } image.save(fileName);@Blackzero said in How do I make the pasted image clear?:
what should be done?
Use proper image- and logo dimensions and don't scale your image after the logo is added since they do not seem so share the same aspect ratio.
If you stretch or shrink your image with the logo inside, the logo may look bad afterwards -
@Blackzero said in How do I make the pasted image clear?:
what should be done?
Use proper image- and logo dimensions and don't scale your image after the logo is added since they do not seem so share the same aspect ratio.
If you stretch or shrink your image with the logo inside, the logo may look bad afterwards