Black Color Showing on Cmy Channels When Converted to Cmyk Using Ghostscript

ghostscript: convert PDF into CMYK preserving pure Black for text

Try this:

collink -v -G AppleRGB.icc JapanColor2002Newspaper.icc apple_to_jNP_photo.icc

collink -v -f AppleRGB.icc JapanColor2002Newspaper.icc apple_to_jNP_neutrals.icc

control.txt:

Image_RGB   apple_to_jNP_photo.icc       0   1   0
Graphic_RGB apple_to_jNP_neutrals.icc 0 1 0
Text_RGB apple_to_jNP_neutrals.icc 0 1 0

and

gswin32c -q -sDEVICE=pdfwrite -o out.pdf -sColorConversionStrategy=CMYK -sSourceObjectICC=control.txt in.pdf

Then the DeviceRGB in source PDF is converted to DeviceCMYK, and RGB 0/0/0 becomes (as I'm checking now) the DeviceGray 0, which should be OK (and all other neutral RGB shades are mapped to true grayscale, too).

The reason we are using different DL-profiles for different objects, is because, though saturated colors (far from neutrals) will be converted to the same CMYK through both profiles, nevertheless you probably don't want color suddenly switch to 0/0/0/n in continuous tone photographs, if color happens to be near neutral -- it'll look terrible on the press.

If your "images" are e.g. rasterized graphics (diagrams, etc.) with 0/0/0 RGB, then you can consider using apple_to_jNP_neutrals.icc for these images too.

If your page has a mix of both real images and rasterized graphics (text) - bad luck, you'll have to compromise.

The reason we use -G instead of fast and simple Simple Mode, is because -f (for second profile) implies the "Gamut Mapping Mode using inverse outprofile A2B", and we want 2 profiles to produce the result (for saturated colors) as close to each other as possible.

Convert PDF to CMYK but ignore black?

With the current version of pdfwrite you are restricted to the colour conversions in the software, and there is nothign you can do about this.

The colour management is undergoing serious revision, and the next release should make it possible to deal with this.

How to force Ghostscript to convert PDF to monochrome bitmap using CMYK colors instead of RGB?

GS will do a conversion from CMYK to Gray through the defined ICC profiles. There are darker CMYK values that exist (for GS's defined CMYK source profile -- and for most) compared to a CMYK value of [0 0 0 100] So, [0 0 0 100] ends up being mapped to something that is not the darkest in the Gray output space.

A couple options would be to try

-dUseFastColor

which will avoid the use of ICC profiles for color mapping and use old school 255-X with UCR/BG type mappings.

Another option is to use

-dBlackText=true

This will force all text components (except for Type 3 fonts) to be filled (or stroked) with a gray value of 0 which should map to 0 for the bmpmono device.

Create CMYK+alpha bitmap, mapping black to specific CMYK color

Jos Vernon at websupergoo came up with a splendidly simple answer that uses ABCpdf capabilities.

using WebSupergoo.ABCpdf10;
using WebSupergoo.ABCpdf10.Objects;

namespace RecolorRenderedImage
{
class Program
{
static void Main(string[] args)
{
using (Doc theDoc = new Doc()) {
// this background image is there to prove that the text is not obscuring other pdf objects
theDoc.AddImage("c:\\temp\\background-pic.jpg");

// this is the black warped text
string fullFilePath = "c:\\temp\\foobar.png";

// read it into an XImage. Add to the doc, and retrieve the pixmap
XReadOptions readOptions = new XReadOptions();
XImage image = XImage.FromFile(fullFilePath, readOptions);
int theID = theDoc.AddImageObject(image, true);
int imageID = theDoc.GetInfoInt(theID, "XObject");
PixMap thePM = (PixMap)theDoc.ObjectSoup[imageID];

// recolor the pixmap temporary spot color space with the desired color (gold in this case)
int spotColorID = theDoc.AddColorSpaceSpot("tempSpace", "24 44 100 2");
ColorSpace theSP = (ColorSpace)theDoc.ObjectSoup[spotColorID];
thePM.Recolor(theSP);

// immediately recolor the pixmap back to CMYK
ColorSpace theSP2 = new ColorSpace(theDoc.ObjectSoup, ColorSpaceType.DeviceCMYK);
thePM.Recolor(theSP2);

theDoc.Save("c:\\temp\\test.pdf");
}
}

}
}

LATE EDIT: removed the link to the output file since I deleted it from GDrive at some point.



Related Topics



Leave a reply



Submit