From 2e4472f79f02d764052783fa83c75cf312fde437 Mon Sep 17 00:00:00 2001 From: Till Kamppeter Date: Tue, 8 Mar 2022 20:50:07 +0100 Subject: [PATCH] libcupsfilters: In ghostscript() do not use gray profile on color PCLm 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 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/cupsfilters/ghostscript.c b/cupsfilters/ghostscript.c index 7efc2d40d..f4d58644c 100644 --- a/cupsfilters/ghostscript.c +++ b/cupsfilters/ghostscript.c @@ -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) -- 2.47.3