Knowledge Base



GeoExpress - Knowledge Base Articles

A060504 - J2K files not recognized by J2KImageReader class

Products:

GeoExpress SDK 4.x and 5.0

Summary:

Files that have extensions other than .jp2 or .jpx — specifically, .j2k — may not be recognized correctly by the J2KImageReader class using the by-filename constructor.

Solution:

Either use the b-stream constructor or change the extension of the file using the following rules:

(1) if the first 12 bytes of the file are these:

      static const lt_uint8 ref[12] = { 0x00, 0x00, 0x00, 0x00c,
                                        0x6a, 0x50, 0x20, 0x20,
                                        0x0d, 0x0a, 0x87, 0x0a };
    then the file is "boxed", i.e. ".jp2"
(2) else, if the first 4 bytes of the file are these:
      static const lt_uint8 ref[4] = { 0xff, 0x4f,
                                       0xff, 0x51 };

    then the file is "unboxed", i.e. ".jpc"
(3) else, file is not JPEG 2000

Reference Number:

TT-11701

This article was last updated or verified on 4 August 2012.