Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to look up info about reading JPEG's color profile info and to my surprise there's very little open specific how-to information on that regard, but rather lots of general explanation on what it is.

Does anyone know how to find and read the color profile information from JPEG?

share|improve this question
Can't seem to find your SO question. Did you delete it before posting here? If so... thanks ;) For future reference you can flag your question for moderation attention and ask for it to be moved to a more suitable site. – Yannis Nov 20 '12 at 12:46
use an existing image library that converts the jpeg to a pixel array – ratchet freak Nov 20 '12 at 12:47
I'd love to, but Flex doesn't have any of those, unfortunately. Apparently no one bothered with that issue so far. – Igor K. Nov 20 '12 at 12:56
Have you tried using Kakadu? – staticx Nov 20 '12 at 14:08
@YannisRizos It isn't one of his deleted questions either. – NullUserException Nov 20 '12 at 17:50
up vote 3 down vote accepted

Independent JPEG ground - is the authority (reference) code for JPEG decoding and JPEG encoding encapsuled as libjpeg; which is also the most portable and default library for JPEG in most platforms.

You should try to dig into libjpeg for this.

Specifically, there is an ambiguity in the native representation of JPEG's color space. As IJG's documentation describes:

The JPEG standard itself is "color blind" and doesn't specify any particular color space. It is customary to convert color data to a luminance/chrominance color space before compressing, since this permits greater compression. The existing de-facto JPEG file format standards specify YCbCr or grayscale data (JFIF), or grayscale, RGB, YCbCr, CMYK, or YCCK (Adobe). For special applications such as multispectral images, other color spaces can be used, but it must be understood that such files will be unportable.

Different applications actually have a different ways to represent this which is actually a problem. See this:

However, it doesn't mean that things are absolutely broken. The information related to color space is usually in the file format, namely JFIF or EXIF.


For JFIF (Reference 1: OR Reference 2) - there is a notion of default color space.
From the spec:

Standard color space The color space to be used is YCbCr as defined by CCIR 601 (256 levels). The RGB components calculated by linear conversion from YCbCr shall not be gamma corrected (gamma = 1.0). If only one component is used, that component shall be Y.

The conversion of YCbCr to RGB and vice-versa is also given in the same document. You can also checkout the libjpeg library (IJG) for actual code on this.



The color space information tag (ColorSpace) is always recorded as the color space specifier. Normally sRGB (=1) is used to define the color space based on the PC monitor conditions and environment. If a color space other than sRGB is used, Uncalibrated (=FFFF.H) is set.

EXIF, allows to specify your custom color table and gamma levels through alternative set of tags including: TransferFunction, white point, PrimaryChromaticities, ReferenceBlackWhite and YCbCrCoefficients.

See. Appendix E, "Color Space Guidelines," Reference:

See also,

  1. JPEG Files -wikipedia
  2. JFIF, JPEG File Interchange Format, Version 1.02
  3. Embedding ICC profiles in image file formats
share|improve this answer
Wow, that's comprehensive! Thank you! – Igor K. Nov 22 '12 at 11:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.