Home
Phabricator
Search
Log In
Paste
P370
(An Untitled Masterwork)
Active
Public
Actions
Authored by
davidre
on Apr 12 2019, 1:04 PM.
Edit Paste
Archive Paste
View Raw File
Subscribe
Mute Notifications
Award Token
Flag For Later
Tags
None
Subscribers
None
diff --git a/src/ExportManager.cpp b/src/ExportManager.cpp
index 78ef058..f9e6ab2 100644
--- a/src/ExportManager.cpp
+++ b/src/ExportManager.cpp
@@ -290,14 +290,27 @@ QString ExportManager::makeSaveMimetype(const QUrl &url)
bool ExportManager::writeImage(QIODevice *device, const QByteArray &format)
{
- QImageWriter imageWriter(device, format);
- imageWriter.setQuality(SpectacleConfig::instance()->compressionQuality());
- if (!(imageWriter.canWrite())) {
- emit errorMessage(i18n("QImageWriter cannot write image: %1", imageWriter.errorString()));
- return false;
- }
+ for (const auto& format : QImageWriter::supportedImageFormats()) {
+ QImageWriter imageWriter(QString::fromLatin1(format)+QStringLiteral("_quality100.")+QString::fromLatin1(format), format);
+ imageWriter.setQuality(100);
+ imageWriter.write(mSavePixmap.toImage());
+
+ imageWriter.setFileName(QString::fromLatin1(format)+QStringLiteral("_quality0.")+QString::fromLatin1(format));
+ imageWriter.setQuality(0);
+ imageWriter.write(mSavePixmap.toImage());
+
+ imageWriter.setFileName(QString::fromLatin1(format)+QStringLiteral("_quality0compression0.")+QString::fromLatin1(format));
+ imageWriter.setCompression(0);
+ imageWriter.setQuality(0);
+ imageWriter.write(mSavePixmap.toImage());
- return imageWriter.write(mSavePixmap.toImage());
+ imageWriter.setFileName(QString::fromLatin1(format)+QStringLiteral("_quality100compression100.")+QString::fromLatin1(format));
+ imageWriter.setCompression(100);
+ imageWriter.setQuality(100);
+ imageWriter.write(mSavePixmap.toImage());
+
+ }
+ return true;
}
davidre
created this paste.
Apr 12 2019, 1:04 PM
davidre
created this object in space
S1 KDE Community
.
davidre
mentioned this in
D19591: Add Compression Quality slider for lossy formats
.
Apr 12 2019, 1:10 PM
Log In to Comment