View Source

h2. Description

ICC profiles are commonly used to define an image's colour space. The JP2 specification ([JP2^15444-1annexi.pdf]) defines a method for embedding profiles in JP2, which is called the _Restricted ICC_ method. Using a subset of the full ICC specification, the following restrictions apply:
# For RGB colour spaces, N-component LUT-based profiles are not allowed (only three-component matrix-based profiles).
# Only _input_ device profiles are allowed (for both monochrome and RGB spaces)

The most commonly used working colour spaces such as Adobe RGB and eciRGB belong to the class of _display_ device profiles. As a result, these profiles are not permitted in JP2, even though they are technically identical to _input_ device profiles. This restriction is dealt with differently by different encoders/decoders. In some cases this results in files that don't adhere to the JP2 specification. In particular, some encoders will produce [JPX] files that use an embedding method (_Any ICC_ method) that is not allowed in JP2. The standards committee is currently addressing this issue through an amendement to the existing standard (see below).

h2. Risks

* Strict adherence to the standard will severely limit colour management in JP2 (which may have an impact on overall image quality).
* The various solutions for getting around the _input_ profile limitation sometimes result in files that do not conform to the standard. Consequently such images may not display as originally intended, or colour information may get lost in future migrations.

h2. Assessment

Files that contain features that are not permitted in JP2 will not pass validation by [Jpylyzer].

|*Tool*|*Affected if expression returns _True_*||
|[Jpylyzer]| {{"/jpylyzer/isValidJP2 = 'False'"}}|

[Jpylyzer] performs the following ICC-related tests:
|methIsValid|: colour specification is valid|
|iccPermittedProfileClass|: profile class is either _input device_ or _display device_|
|iccNoLUTBasedProfile|: profile is not of the _N-component LUT-based_ type|
|iccSizeIsValid|: actual size of embedded ICC profile equals value of profileSize field in ICC header|

Note that [Jpylyzer] does _not_ validate the actual ICC profile data (i.e. it does not include an ICC profile validator)! It only checks whether a specific ICC profile's feature set meets the criteria defined by the _Restricted ICC_ method.

A JP2 will _not_ pass validation if _any_ of the above tests fail. The subsections below, which describe how to check the most important ICC-related properties, are provided for information only.

h3. Check value of colour specification method (METH field)

|*Tool*|*Location in output*|
|[Jpylyzer]| {{"/jpylyzer/properties/jp2HeaderBox/colourSpecificationBox/meth"}}|

Possible values:
|Enumerated|: Named colour space (no ICC profile)|
|Restricted ICC|: Restricted ICC method|
|Any ICC|: Any ICC method (not allowed in JP2, only in [JPX]; file will not pass validation!)|

h3. Check value of profile ICC profile class

|*Tool*|*Location in output*|
|[Jpylyzer]| {{"/jpylyzer/properties/jp2HeaderBox/colourSpecificationBox/icc/profileClass"}}|

Possible values:
|Input Device Profile|
|Display Device Profile|

In case of any other values (possible in ICC, but not allowed in JP2) the file will not pass validation!

h3. Check name (description) of ICC profile

|*Tool*|*Location in output*|
|[Jpylyzer]| {{"/jpylyzer/properties/jp2HeaderBox/colourSpecificationBox/icc/description"}}|

Example values:
|Adobe RGB (1998)|
|Gray Gamma 2.2|

h2. ICC profile handling by popular JPEG 2000 implementations

The table below shows, number of widely-used encoder/decoder applications, what happens when we try to create a JP2 from a source TIFF that contains an embedded _display_ device profile.

|*Encoder*|*Output format*|*Embedding method*|
|Kakadu _kdu_compress_ (Kakadu 7.2 and more recent) |JP2|Restricted ICC|
|Kakadu _kdu_compress_ (Kakadu versions up to 7.1) |JP2|ICC profile not embedded|
|Aware JPEG 2000 SDK |JP2|Restricted ICC|
|Luratech command line tool, version 2.1.22.0|JP2|Restricted ICC (but profile class field changed to _input_ device)|
|Luratech command line tool, version 2.1.20.10|JPX|Any ICC|
|Adobe Photoshop CS4 with Adobe JPEG2000 plugin, "JP2 compatible" option _not_ checked|JPX|Any ICC|
|Adobe Photoshop CS4 with Adobe JPEG2000 plugin, "JP2 compatible" option checked|JPX|Any ICC + Restricted ICC [#* Note] |
|ImageMagick|JP2|ICC profile not embedded|
|GraphicsMagick|JP2|ICC profile not embedded|
|OpenJPEG|JP2|ICC profile not embedded|

*Source*: [http://www.dlib.org/dlib/may11/vanderknijff/05vanderknijff.html] with additional (unpublished) tests by same author.

{anchor:* Note}*Note:* Original profile uses "Any ICC" method; modified version uses "Restricted" method, where profile class of the original profile (_display_ device) is changed to _input_ device, and a "modified" prefix is added to the profile description field (e.g. "Modified eciRGB v2").


h2. Recommendations

h3. Pre-ingest

Use [Jpylyzer] to establish if files are valid JP2. Jpylyzer checks if embedded ICC profiles are allowed. Images that use embedding methods that are specific to [JPX] will not pass the validation.

h3. Existing collections

* Use [Jpylyzer] to establish if files are valid JP2 (see above).
* If files fail the above test, mark this in their associated metadata. Document the issue and the associated risks.
* Normalisation of files that contain [JPX] specific embedding methods may be considered.

h2. 2013 changes to the standard

In May 2013 an amendment to the standard was published which allows, among other things, the use of display device profiles in JP2. See also the following [blog post by Rob Buckley|http://jpeg2000wellcomelibrary.blogspot.com/2011/04/guest-post-color-in-jp2.html], and the [August 2011 draft of the amendment|http://www.itscj.ipsj.or.jp/sc29/open/29view/29n12288t.doc]. This amendment completely fixes the previous shortcomings of the standard.

h2. Example files
The following 2 files were created with Adobe Photoshop CS4 + Adobe JPEG2000 plugin 2.0:
* [http://www.opf-labs.org/format-corpus/jp2k-test/icc/balloon_eciRGBv2_ps_adobeplugin.jpf] - ICC profile uses Any ICC method
* [http://www.opf-labs.org/format-corpus/jp2k-test/icc/balloon_eciRGBv2_ps_adobeplugin_jp2compatible.jpf] - two versions of ICC profile: one uses Any ICC, other Restricted ICC method

This file was created with the Aware JPEG 2000 SDK 3.19:
* [http://www.opf-labs.org/format-corpus/jp2k-test/icc/balloon_eciRGBv2_aware.jp2] - ICC profile uses Restricted ICC method


h2. References

[Buckley, R. Color in JP2. Wellcome Library. April 2011 |http://blog.wellcomelibrary.org/2011/04/guest-post-color-in-jp2/]
[Van der Knijff, J.M. JPEG 2000 for Long-term Preservation: JP2 as a Preservation Format. D-Lib Magazine Volume 17, Number 5/6. May 2011 |http://www.dlib.org/dlib/may11/vanderknijff/05vanderknijff.html]
[Van der Knijff, J.M. ICC profiles and resolution in JP2: update on 2011 D-Lib paper. |http://www.openplanetsfoundation.org/blogs/2013-07-01-icc-profiles-and-resolution-jp2-update-2011-d-lib-paper]
[ISO/IEC 15444-1:2004/PDAM 6. Updated ICC profile support, bit depth and resolution clarifications. Draft, August 2011.|http://www.itscj.ipsj.or.jp/sc29/open/29view/29n12288t.doc]
[T.800 : Updated ICC profile support, bit depth and resolution clarifications|http://www.itu.int/rec/T-REC-T.800-201303-P!Amd6/en]