]> git.ipfire.org Git - thirdparty/cups-filters.git/commitdiff
libcupsfilters: In ghostscript() do not use gray profile on color PCLm
authorTill Kamppeter <till.kamppeter@gmail.com>
Tue, 8 Mar 2022 19:50:07 +0000 (20:50 +0100)
committerTill Kamppeter <till.kamppeter@gmail.com>
Tue, 8 Mar 2022 19:50:07 +0000 (20:50 +0100)
The "pclm" output device of Ghostscript only supports 8-bit sRGB
output, no sGray and also no color-to -monochrome conversion. There is
also no way to convert to grayscale by simply applying a gray color
profile.

Applying the gray color profile caused a crash in older versions of
Ghostscript and now is rejected with an error. See

    https://bugs.ghostscript.com/show_bug.cgi?id=705014

cupsfilters/ghostscript.c

index 7efc2d40d83ec34b012b0d0b0b81b235a7c01e54..f4d58644c66ba56236dc68e81d1811a8560cdaf1 100644 (file)
@@ -1501,9 +1501,18 @@ ghostscript(int inputfd,         /* I - File descriptor input stream */
   } else if (!cm_disabled &&
             outformat == OUTPUT_FORMAT_PCLM) {
     /* Set standard output ICC profile sGray/sRGB */
-    if (h.cupsColorSpace == CUPS_CSPACE_SW)
+    /*if (h.cupsColorSpace == CUPS_CSPACE_SW)
       cupsArrayAdd(gs_args, strdup("-sOutputICCProfile=sgray.icc"));
-    else if (h.cupsColorSpace == CUPS_CSPACE_SRGB)
+      else if (h.cupsColorSpace == CUPS_CSPACE_SRGB)*/
+    /* Note that Ghostscript can only output PCLm with its "pclm" device
+       in 8-bit sRGB, not in grayscale, so we always use the sRGB color
+       profile for now.
+       It is not possible to convert to grayscale by applying the gray
+       color profile on GhostScript's "pclm" device, see
+       https://bugs.ghostscript.com/show_bug.cgi?id=705014
+       We eill need an additional output device, like "pclm8", if we
+       want grayscale PCLM output, see
+       https://bugs.ghostscript.com/show_bug.cgi?id=705035 */
       cupsArrayAdd(gs_args, strdup("-sOutputICCProfile=srgb.icc"));
   }
   else if (!cm_disabled)