mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2026-03-22 07:39:48 -04:00
Improve CMYK writing support
Closes #11 Requires MR !279 On formats that does not support CMYK and does not use the ScanLineConverter class during write operation, the CMYK images must be converted using the color space conversion functions of `QImage` (if ICC profile is valid).
This commit is contained in:
@ -9,6 +9,7 @@
|
||||
#include "util_p.h"
|
||||
|
||||
#include <QColor>
|
||||
#include <QColorSpace>
|
||||
#include <QDataStream>
|
||||
#include <QDebug>
|
||||
#include <QImage>
|
||||
@ -877,6 +878,12 @@ bool PCXHandler::write(const QImage &image)
|
||||
s.setByteOrder(QDataStream::LittleEndian);
|
||||
|
||||
QImage img = image;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 8, 0)
|
||||
auto cs = image.colorSpace();
|
||||
if (cs.isValid() && cs.colorModel() == QColorSpace::ColorModel::Cmyk && image.format() == QImage::Format_CMYK8888) {
|
||||
img = image.convertedToColorSpace(QColorSpace(QColorSpace::SRgb));
|
||||
}
|
||||
#endif
|
||||
|
||||
const int w = img.width();
|
||||
const int h = img.height();
|
||||
|
||||
Reference in New Issue
Block a user