diff --git a/src/imageformats/exr.cpp b/src/imageformats/exr.cpp index bb391c8..92e42e5 100644 --- a/src/imageformats/exr.cpp +++ b/src/imageformats/exr.cpp @@ -774,9 +774,16 @@ bool EXRHandler::write(const QImage &image) // set the DCT quality (used by DCT compressions only) if (m_quality > -1 && m_quality <= 100) { header.dwaCompressionLevel() = float(m_quality); +#if QT_VERSION_CHECK(OPENEXR_VERSION_MAJOR, OPENEXR_VERSION_MINOR, OPENEXR_VERSION_PATCH) >= QT_VERSION_CHECK(3, 5, 0) + header.lossyHTJ2KQuality() = float(m_quality) * 1.5f; // Lossy J2K max quality is 150 +#endif } // make ZIP compression fast (used by ZIP compressions) header.zipCompressionLevel() = 1; +#if QT_VERSION_CHECK(OPENEXR_VERSION_MAJOR, OPENEXR_VERSION_MINOR, OPENEXR_VERSION_PATCH) >= QT_VERSION_CHECK(3, 5, 0) + // make ZSTD compression fast (used by ZSTD compressions) + header.zstdCompressionLevel() = 1; // default is 5 -> 1 is faster +#endif // set preview (don't set it for small images) if (width > 1024 || height > 1024) { diff --git a/src/imageformats/exr_p.h b/src/imageformats/exr_p.h index 7c45d15..d0b5e9f 100644 --- a/src/imageformats/exr_p.h +++ b/src/imageformats/exr_p.h @@ -76,18 +76,21 @@ private: * Value set by QImageWriter::setCompression(). * * The compression scheme is the same as defined by OpenEXR library: - * - 0: no compression - * - 1: run length encoding - * - 2: zlib compression, one scan line at a time - * - 3: zlib compression, in blocks of 16 scan lines - * - 4: piz-based wavelet compression (default) - * - 5: lossy 24-bit float compression - * - 6: lossy 4-by-4 pixel block compression, fixed compression rate - * - 7: lossy 4-by-4 pixel block compression, fields are compressed more + * - 0: no compression. + * - 1: run length encoding. + * - 2: zlib compression, one scan line at a time. + * - 3: zlib compression, in blocks of 16 scan lines. + * - 4: piz-based wavelet compression (default). + * - 5: lossy 24-bit float compression. + * - 6: lossy 4-by-4 pixel block compression, fixed compression rate. + * - 7: lossy 4-by-4 pixel block compression, fields are compressed more. * - 8: lossy DCT based compression, in blocks of 32 scanlines. More efficient for partial buffer access. * - 9: lossy DCT based compression, in blocks of 256 scanlines. More efficient space wise and faster to decode full frames than DWAA_COMPRESSION. * - 10: High-Throughput JPEG2000 (HTJ2K), 256 scanlines (requires OpenEXR 3.4+). * - 11: High-Throughput JPEG2000 (HTJ2K), 32 scanlines (requires OpenEXR 3.4+). + * - 12: High-Throughput JPEG2000 (HTJ2K), lossy, 256 scanlines (requires OpenEXR 3.5+). + * - 13: zstd lossless compression, one scan line at a time (requires OpenEXR 3.5+). + * \note If compiled with a more recent EXR library, any new compression methods can be used. */ qint32 m_compressionRatio;