mirror of
https://invent.kde.org/frameworks/kimageformats.git
synced 2025-05-28 00:30:23 -04:00
Less space used when saving a grayscale image
This commit is contained in:
parent
f34185197a
commit
f065104b72
@ -621,7 +621,14 @@ bool EXRHandler::write(const QImage &image)
|
||||
|
||||
// write the EXR
|
||||
K_OStream ostr(device(), QByteArray());
|
||||
Imf::RgbaOutputFile file(ostr, header, image.hasAlphaChannel() ? Imf::RgbaChannels::WRITE_RGBA : Imf::RgbaChannels::WRITE_RGB);
|
||||
auto channelsType = image.hasAlphaChannel() ? Imf::RgbaChannels::WRITE_RGBA : Imf::RgbaChannels::WRITE_RGB;
|
||||
if (image.format() == QImage::Format_Mono ||
|
||||
image.format() == QImage::Format_MonoLSB ||
|
||||
image.format() == QImage::Format_Grayscale16 ||
|
||||
image.format() == QImage::Format_Grayscale8) {
|
||||
channelsType = Imf::RgbaChannels::WRITE_Y;
|
||||
}
|
||||
Imf::RgbaOutputFile file(ostr, header, channelsType);
|
||||
Imf::Array2D<Imf::Rgba> pixels;
|
||||
pixels.resizeErase(EXR_LINES_PER_BLOCK, width);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user