From 86d31b233b78be10929ce29d9f286009eb99e728 Mon Sep 17 00:00:00 2001
From: Even Rouault <[EMAIL REDACTED]>
Date: Sun, 8 Oct 2023 20:20:04 +0200
Subject: [PATCH] tiffcp: preserve TIFFTAG_REFERENCEBLACKWHITE when doing YCbCr
JPEG -> YCbCr JPEG
---
tools/tiffcp.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/tools/tiffcp.c b/tools/tiffcp.c
index d2dd6b17..3f761feb 100644
--- a/tools/tiffcp.c
+++ b/tools/tiffcp.c
@@ -879,6 +879,12 @@ static int tiffcp(TIFF *in, TIFF *out)
{
TIFFGetFieldDefaulted(in, TIFFTAG_YCBCRSUBSAMPLING,
&subsamplinghor, &subsamplingver);
+
+ float *refBW = NULL;
+ if (TIFFGetField(in, TIFFTAG_REFERENCEBLACKWHITE, &refBW))
+ {
+ TIFFSetField(out, TIFFTAG_REFERENCEBLACKWHITE, refBW);
+ }
}
TIFFSetField(out, TIFFTAG_YCBCRSUBSAMPLING, subsamplinghor,
subsamplingver);