From 6ac57b1ed88ff68376997858a35281fb0582abf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hubert=20Figui=C3=A8re?= Date: Sat, 28 May 2022 10:56:37 -0400 Subject: [PATCH] Include patch for upstream https://github.com/4lex4/scantailor-advanced/pull/166 --- com.github._4lex4.ScanTailor-Advanced.yaml | 2 ++ scantailor-tiffsave-fix.patch | 26 ++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 scantailor-tiffsave-fix.patch diff --git a/com.github._4lex4.ScanTailor-Advanced.yaml b/com.github._4lex4.ScanTailor-Advanced.yaml index 11d519a..bd8ba5d 100644 --- a/com.github._4lex4.ScanTailor-Advanced.yaml +++ b/com.github._4lex4.ScanTailor-Advanced.yaml @@ -44,6 +44,8 @@ modules: path: com.github._4lex4.ScanTailor-Advanced.metainfo.xml.in - type: patch path: scantailor-qt5.15.patch + - type: patch + path: scantailor-tiffsave-fix.patch buildsystem: cmake-ninja config-opts: - -DCMAKE_BUILD_TYPE=RelWithDebInfo diff --git a/scantailor-tiffsave-fix.patch b/scantailor-tiffsave-fix.patch new file mode 100644 index 0000000..6a3cc97 --- /dev/null +++ b/scantailor-tiffsave-fix.patch @@ -0,0 +1,26 @@ +From f6ae1624bf2cb55d1bd10a14d6215c2414633e32 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Hubert=20Figui=C3=A8re?= +Date: Tue, 5 Jan 2021 15:23:48 -0500 +Subject: [PATCH] Issue #164 - Fix TIFF saving when JPEG and posterized + +--- + src/core/TiffWriter.cpp | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/core/TiffWriter.cpp b/src/core/TiffWriter.cpp +index 0713e05ad..f84be661c 100644 +--- a/src/core/TiffWriter.cpp ++++ b/src/core/TiffWriter.cpp +@@ -222,8 +222,10 @@ bool TiffWriter::writeBitonalOrIndexed8Image(const TiffHandle& tif, const QImage + } + + if (image.format() == QImage::Format_Indexed8) { +- TIFFSetField(tif.handle(), TIFFTAG_COMPRESSION, +- uint16(ApplicationSettings::getInstance().getTiffColorCompression())); ++ uint16 compress = (photometric == PHOTOMETRIC_PALETTE) ? ++ COMPRESSION_LZW : ++ uint16(ApplicationSettings::getInstance().getTiffColorCompression()); ++ TIFFSetField(tif.handle(), TIFFTAG_COMPRESSION, compress); + } else { + TIFFSetField(tif.handle(), TIFFTAG_COMPRESSION, uint16(ApplicationSettings::getInstance().getTiffBwCompression())); + }