mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-05-28 00:30:23 -04:00
Treat 3-channel MCH images as CMY images
This commit is contained in:
parent
34ed3bad27
commit
6559bf8994
BIN
autotests/read/psd/mch3-16bits.png
Normal file
BIN
autotests/read/psd/mch3-16bits.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 71 KiB |
BIN
autotests/read/psd/mch3-16bits.psb
Normal file
BIN
autotests/read/psd/mch3-16bits.psb
Normal file
Binary file not shown.
BIN
autotests/read/psd/mch3-8bits.png
Normal file
BIN
autotests/read/psd/mch3-8bits.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 39 KiB |
BIN
autotests/read/psd/mch3-8bits.psb
Normal file
BIN
autotests/read/psd/mch3-8bits.psb
Normal file
Binary file not shown.
@ -669,7 +669,7 @@ static bool IsSupported(const PSDHeader &header)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (header.color_mode == CM_MULTICHANNEL &&
|
if (header.color_mode == CM_MULTICHANNEL &&
|
||||||
header.channel_count < 4) {
|
header.channel_count < 3) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -916,8 +916,8 @@ inline void cmykToRgb(uchar *target, qint32 targetChannels, const char *source,
|
|||||||
auto max = double(std::numeric_limits<T>::max());
|
auto max = double(std::numeric_limits<T>::max());
|
||||||
auto invmax = 1.0 / max; // speed improvements by ~10%
|
auto invmax = 1.0 / max; // speed improvements by ~10%
|
||||||
|
|
||||||
if (sourceChannels < 4) {
|
if (sourceChannels < 3) {
|
||||||
qDebug() << "cmykToRgb: image is not a valid CMYK!";
|
qDebug() << "cmykToRgb: image is not a valid CMY/CMYK!";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -926,7 +926,7 @@ inline void cmykToRgb(uchar *target, qint32 targetChannels, const char *source,
|
|||||||
auto C = 1 - *(ps + 0) * invmax;
|
auto C = 1 - *(ps + 0) * invmax;
|
||||||
auto M = 1 - *(ps + 1) * invmax;
|
auto M = 1 - *(ps + 1) * invmax;
|
||||||
auto Y = 1 - *(ps + 2) * invmax;
|
auto Y = 1 - *(ps + 2) * invmax;
|
||||||
auto K = 1 - *(ps + 3) * invmax;
|
auto K = sourceChannels > 3 ? 1 - *(ps + 3) * invmax : 0.0;
|
||||||
|
|
||||||
auto pt = t + targetChannels * w;
|
auto pt = t + targetChannels * w;
|
||||||
*(pt + 0) = T(std::min(max - (C * (1 - K) + K) * max + 0.5, max));
|
*(pt + 0) = T(std::min(max - (C * (1 - K) + K) * max + 0.5, max));
|
||||||
|
Loading…
Reference in New Issue
Block a user