Open prdolmos opened 8 years ago
Just as information for someone wanting to implement this: For this to work the color space of the image has to be set to /ICCBased and the ICC profile extracted from the image and embedded into the PDF as separate object (see PDF1.7 spec chapter 8.6.5.5 for ICCBased color spaces and chapter 8.9.5 for image dictionaries). I don't know if ICC profiles embedded in JPEG files are recognized by conformant PDF readers but I doubt it.
I would be very open to a PR implementing the embedding of ICC profiles, but you are correct our current implementations do not.
In my prawn-pdfimage library I will duplicate an ICC profile that exists on an image in another PDF if someone would like to reference that as well for developing this.
If anyone is interested, I did some work to support embedding ICC Profiles from PNG files. You can review it in this commit. It's mixed up with code to support indexed-color PNG with less than 8 bits per pixel. Unfortunately, I had to drop that task for now.
I've tested embedding several different images and in all cases they lose their embedded color profiles, and appear as DeviceCMYK/DeviceRGB.
I've read on PDF/X with Prawn not being an option at the moment, which leaves out being able to use Output Intents, but individual embedded ICC profiles is as useful.