I would like to be able to detect the presence of a color profile in JPEG. To be clear: I'm not interested in actually carrying out the color corrections or doing anything else with them.
I did some investigation, but I could not find any definite source of information. Here is what I know so far:
There is a color profile information in the XMP block. The XMP block is in a 0xFFE1 JPEG section (the same as EXIF). The marked of this section is followed by the http://ns.adobe.com/xap/1.0/ string. However, when I stripped this section, Photoshop was still able to detect the color profile.
There is a color space tag in EXIF itself as well (tag = 0xA001). It has only one value defined in the EXIF specification: 1 = sRGB. I noticed that in my image it takes the value 0xFFFF which means uncalibrated. So it’s not this tag.
I did an experiment with one image saving it in two different color profiles, and besides the changes in XMP and EXIF, I noticed that there is probably a whole new JPEG section. It starts by 0xFFE2 and its marker is followed by the string ICC_PROFILE. This seems to be the most likely case.
Does anybody have experience with managing color profiles in JPEG? I would say that the information in EXIF and XMP are just metadata, and that the important thing is the presence of the ICC_PROFILE section.
ICC profiles are stored in a JPEG file's Application Segments. These blocks are for letting applications store whatever data they need, so they are not mandated by the JPEG spec. In other words, the JPEG file format does not define a way to embed color profiles, you are just seeing the de facto ways of doing it.
Since the application segments can be used by anyone for anything, you need to identify and validate the contents, before you can say for certain that it contains an ICC profile.
So there are three ways common ways ICC profiles could be supplied:
ICC_PROFILE\0x00\0x01\0x01
for identifying it. I'm currently unsure if the two \0x01
mean anything, or if they are always that. After those 14 characters, the actual ICC profile is stored.http://ns.adobe.com/xap/1.0/\0x00
.I have not been able to find any concrete information either. It would be nice if ICC said, "this is how to do it", but I have not yet been able to find any of the sort. Thus as far as I know, any of these could potentially be used as an ICC profile and it would depend on the application on whether it would load the profile or not. Application Segment 02 seems to be the common way of doing it, though what you want to check might depend on your use case. As the other comment showed, some HELIOS EtherShare software has/had its own way of doing it. (I have not yet confirmed the presence of an ICC profile in the metadata, however I haven't really looked that hard and it wouldn't surprise me if you could find files with multiple conflicting ICC profiles in the wild.)
Here is an information about ICC profiles in JPEG: http://209.85.129.132/search?q=cache%3ANx_M6GRbZzYJ%3Awww.helios.de%2FPDFs%2FICC-tag.pdf+JPEG+format+ICC+offset&hl=ru&gl=ru
That's from Google cache.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With