Joe9
Joe9

Reputation: 47

ghostscript: convert PDF into GRAY preserving pure Black for text

I need to convert RGB PDF into a CMYK/GRAY PDF. I use the following command line:

    gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite \
       -dEmbedAllFonts=true \
       -dPDFSETTINGS="/prepress" \
       \
       -sColorConversionStrategy=$2 \
       -sColorConversionStrategyForImages=$2 \
       -dProcessColorModel=$3 \
       \
       -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode \
       -dAutoFilterGrayImages=false -dGrayImageFilter=/FlateEncode \
       -dMonoImageFilter=/FlateEncode \
       \
       -dDownsampleColorImages=false \
       -dDownsampleGrayImages=false \
       -dDownsampleMonoImages=false \

where $3 is /DeviceGray or DeviceCMYK and $2 is CMYK or Gray.

Unfortunately the text is in the gray mode only 91% black. In the CMYK mode the text is 100% black. How can I set the text to 100% black in the gray mode?

I use GS 9.26 and no special ICC profiles.

Upvotes: 1

Views: 788

Answers (1)

KenS
KenS

Reputation: 31139

You cannot convert to Gray while preserving text as Black, it will be converted to Gray as well.

You could provide an ICC prfile which converts R=G=B=0 into a CIE colour which, when mapped back through through the Gray ICC profile results in 100% gray, which is the same (obviously) as black. I'm afraid its up to you to source suitable ICC profiles.

With the current version of Ghostscript you don't need to (and shouldn#'t) set the ProcessColorModel when using ColorConversionStrategy, it'll be set for you.

Upvotes: 1

Related Questions