mirror of
				https://invent.kde.org/frameworks/kimageformats.git
				synced 2025-11-03 13:24:20 -05:00 
			
		
		
		
	Less space used when saving a grayscale image
This commit is contained in:
		@ -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);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user