Hello,
As I understand the PDF Specifications it's possible to directly include a JPEG file in a PDF.
It has to be encapsulated into a XObject and its filter must be set to DCTDecode.
(Even the JPEG header and such get stored in the final PDF)
So I wrote a litte program using the Adobe PDFL that create such file, basically it reads the entire JPEG file using a ASStm [ASFileStmRdOpen()] which is called by the [PDEImageCreate()].
I set in the Create() call that the stream is encoded.
Of course it creates alongside this the appropriate PDEColorSpace.
In the end all of this works in RGB I get the intended output.
But when I use CMYK JPEG file, the PDF I get is the negative of the image (as if I applied Adjustements->Invert in Photoshop). Did I miss something for CMYK files ?
Below links to download the test files & the result :
- CMYK (JPG) http://dl.free.fr/h2jecWBpj (PDF) http://dl.free.fr/gv5zecOEp
- RGB (JPG) http://dl.free.fr/nccbrL1mg (PDF) http://dl.free.fr/ho5kqmkD4
Thanks for the help.
Message was edited by: blvd4
I assume your talking about "Table 13 – Optional parameter for the DCTDecode filter" : ColorTransform.
If the encoding algorithm has inserted the Adobe-defined marker code in the encoded data indicating the ColorTransform value, then the colours shall be transformed, or not, after the DCT decoding has been performed according to the value provided in the encoded data and the value of this dictionary entry shall be ignored.
So again if I understood correctly when Photoshop writes the jpeg file it sets the APP14 marker (described here : http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/JPEG.html#Adobe) and isn't this flag sufficient for a PDF reader to make the appropriate conversion for correct CMYK output.
On a sidenote in libjpeg if this marker is present and considering its value and there is 4 components in the input file it sets the colorspace to YCCK. Is YCCK equals to inverted CMYK ?
Or is inverted CMYK flagged elsewhere in a JPEG file ?
I suppose Adobe Reader (the one I use on Linux) is a conforming reader that fully support the PDF specifications and reacts to marker in JPEG file format that in turn get stored in the stream of a XObject, am I wrong ?
Yes, that is EXACTLY what I am suggesting.
// "/Decode Re: JPEG file embedded in PDF (CMYK)" Photoshop CMYK fix
North America
Europe, Middle East and Africa
Asia Pacific