https://github.com/ImageMagick/ImageMagick/discussions/2817
diff --git a/MagickCore/colorspace-private.h b/MagickCore/colorspace-private.h
index 205575f..8fd3b44 100644
--- a/MagickCore/colorspace-private.h
+++ b/MagickCore/colorspace-private.h
@@ -137,6 +137,16 @@
   return(MagickFalse);
 }
 
+static inline MagickBooleanType IsYCbCrCompatibleColorspace(
+  const ColorspaceType colorspace)
+{
+  if ((colorspace == YCbCrColorspace) ||
+      (colorspace == Rec709YCbCrColorspace) ||
+      (colorspace == Rec601YCbCrColorspace))
+    return(MagickTrue);
+  return(MagickFalse);
+}
+
 #if defined(__cplusplus) || defined(c_plusplus)
 }
 #endif
diff --git a/coders/dpx.c b/coders/dpx.c
index 9bac496..a49860a 100644
--- a/coders/dpx.c
+++ b/coders/dpx.c
@@ -46,6 +46,7 @@
 #include "MagickCore/blob-private.h"
 #include "MagickCore/cache.h"
 #include "MagickCore/colorspace.h"
+#include "MagickCore/colorspace-private.h"
 #include "MagickCore/exception.h"
 #include "MagickCore/exception-private.h"
 #include "MagickCore/geometry.h"
@@ -1530,7 +1531,7 @@
           (vertical_factor != 2) && (vertical_factor != 4))
         ThrowWriterException(CorruptImageError,"UnexpectedSamplingFactor");
     }
-  if ((image->colorspace == YCbCrColorspace) &&
+  if ((IsYCbCrCompatibleColorspace(image->colorspace) != MagickFalse) &&
       ((horizontal_factor == 2) || (vertical_factor == 2)))
     if ((image->columns % 2) != 0)
       image->columns++;
@@ -1990,7 +1991,7 @@
   quantum_type=RGBQuantum;
   if (image->alpha_trait != UndefinedPixelTrait)
     quantum_type=RGBAQuantum;
-  if (image->colorspace == YCbCrColorspace)
+  if (IsYCbCrCompatibleColorspace(image->colorspace) != MagickFalse)
     {
       quantum_type=CbYCrQuantum;
       if (image->alpha_trait != UndefinedPixelTrait)