I am having to deal with CMYK JPEGs extracted from a PDF source. The PDFs were created with Photoshop. The problem is that Photoshop stores JPEG CMYK data in PDF/EPS using "normal" values, whereas in standalone JPEGs it stores inverted values. So, when the DCTDecode streams are extracted bytewise and written to disk, the resulting JPEG files appear inverted. *(The actual extraction is done by an in-house utility, which simply extracts the bytes from the DCTDecode stream and writes them, unmodified, to a file ending in `.jpg` It's basically a binary copy-and-paste. The PDFs are available to re-process, should that be required.)* As the images must remain in their JFIF format, is there any way to place a marker into the extracted `.jpg` file to make Photoshop open it with the proper encoding? The process must be lossless (not involve further entropy encoding). The JPEGs already contain the `APP14` marker, and removing it has no effect. Below is a quote from the `libjpeg` docs: > "... it appears that Adobe Photoshop writes inverted data in CMYK JPEG files: 0 represents 100% ink coverage, rather than 0% ink as you'd expect. ... Photoshop 3.0 [and newer]... write uninverted YCCK in EPS/JPEG files... (But the data polarity used in bare JPEG files will not change...)"