View Source

h2. Description

The information that defines the number of tile-parts in each tile in JPX files created with Adobe Photoshop is incorrect (tested with CS4 + Adobe JPEG2000 plugin 2.0; other versions may be affected as well). More specifically, this affects the _tnsot_ field in each tile-part's _SOT_ marker segment. The value of this field defines the number of tile-parts within a tile. However, the values of _tnsot_ that are written by Photoshop's plugin are systematically off by one. This means that for 6 tile-parts per tile, the value of _tnsot_ will be 5 (whereas it really should be 6!), and so on.

h2. Risks

Some readers are simply unable to open these images. This includes software that uses the JasPer library (ImageMagick, GraphicsMagick), and OpenJPEG's _opj_decompress_ tool (OpenJPEG 2.0.0). Other readers render the images without any apparent problems, although it's not entirely clear whether _all_ the available image data are rendered in the highest available quality. This implies a risk that a future migration may result in a degradation of image quality.

h2. Assessment
Files that are affected by this will not pass validation by [Jpylyzer], and result in failure of the _foundExpectedNumberOfTileParts_ test:

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

Also, if you check the values of _tpsot_ (tile-part index) in images that are affected by this issue, you will see that for some tile-parts _tpsot_ equals _tnsot_. For example:

{{/jpylyzer/properties/contiguousCodestreamBox/tileParts/tilePart/sot/tpsot = '5'}}
{{/jpylyzer/properties/contiguousCodestreamBox/tileParts/tilePart/sot/tnsot = '5'}}

Since the numbering of _tpsot_ always starts from 0, this is really impossible: a value of 5 implies that there are actually 6 tile-parts per tile (with _tpsot_ consecutively numbered 0,1,2,3,4,5). So _tnsot_ should really be 6 in this case.

h2. Recommendations

h3. Pre-ingest

Identify files that are affected by this problem using [Jpylyzer] and do not accept them.

h3. Existing collections

* Identify files that are affected by this problem using [Jpylyzer].
* Document the issue and the associated risks, and mark affected materials in metadata.
* Normalisation of affected files to 'proper' JP2s may be considered for important collections (but this would require careful planning and risk assessment).

h2. Example files
Both files 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]
* [http://www.opf-labs.org/format-corpus/jp2k-test/icc/balloon_eciRGBv2_ps_adobeplugin_jp2compatible.jpf]

h2. References