Skip navigation
Currently Being Moderated

JPEG file embedded in PDF (CMYK)

Mar 15, 2012 9:06 AM

Tags: #cmyk #jpeg #pdf #jpg



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 :



- RGB    (JPG)  (PDF)


Thanks for the help.


Message was edited by: blvd4

  • Currently Being Moderated
    Mar 15, 2012 10:04 AM   in reply to blvd4

    You probably forgot to detect that the JPEG image was created by Photoshop which does inverted CMYK and  requires a Decode array.  IIRC there is a note about this in the ISO 32000 document

    Mark as:
  • Currently Being Moderated
    Mar 16, 2012 4:52 AM   in reply to blvd4

    Not, it’s not sufficient because PDF does NOT require that the viewer process that private marker.  The PDF producer needs to locate that marker and process it by putting in a Decode array.

    Mark as:
  • Currently Being Moderated
    Mar 16, 2012 5:14 AM   in reply to blvd4

    Yes, that is EXACTLY what I am suggesting.


    // "/Decode Re: JPEG file embedded in PDF (CMYK)"  Photoshop CMYK fix

    Mark as:
  • Currently Being Moderated
    Feb 12, 2013 4:45 PM   in reply to lrosenth

    How do you apply these arrays?

    Mark as:
  • Currently Being Moderated
    Feb 13, 2013 12:14 AM   in reply to JSalmela

    They are part of the XObject image dictionary.

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points