J2K, JPEG 2000

J2K or JPEG 2000 is an image compression technology using wavelet compression. It appears using three-letter filename extensions of .jp2, .j2k, .jp2, .jpc, .jpf and .jpx.   J2K is aimed primarily at viewing of data, not editing it.    The technology approach is similar to other formats using discrete wavelet technology compression, such as ECW and MrSID, although J2K is more modern and much faster than MrSID.


One key idea behind wavelet compression technologies is that relatively few pixels are shown in whatever viewport or window the viewer displays for the user. An image may be many gigabytes in size but only a few megabytes of pixels will appear on the monitor.    If the format provides means for rapidly fetching a rendering of the image at whatever level of zoom is being used, for example, using intermediate levels, the viewer can leave the big image data in the J2K file and fetch only what is needed to populate those pixels that appear in the display.


Another key idea is using compression to reduce the overall size of the image.  If the decompression technology is fast it can be used as an essential part of the image fetching mechanism, so that fewer bytes need be fetched to synthesize on the fly the decompressed imagery required for the display.


J2K is reasonably fast both at decompression and also at fetching what is necessary to rapidly generate, on-the-fly, whatever view is required of a compressed image.  Applications which use J2K can therefore leave big images in the original J2K file and link that file into their projects, so that when images are opened the J2K machinery brings in for display whatever imagery is required.


In Manifold we can take advantage of that by linking a J2K file into our project.   The link creates a data source cylinder that indicates the data is stored outside of the project, in the original J2K file.  When we expand the data source we can see the image within and then we can use that image as a layer in maps.  This works well in cases when we only intend to view the image and not to edit it.


Linking a J2K into a Manifold project leaves the imagery within J2K format, so any manipulation of that imagery is limited to only what J2K technology can handle.    Since J2K files are normally stored using compression that involves some degree of data loss.  We will not have direct access to the original pixels in whatever was the original image before it was compressed into J2K:  we will only have access to the view that is generated on-the-fly by decompressing the data within the J2K.  


Important: When linking a J2K file the image that appears in that data source in the Manifold project stays resident in the J2K file.   It is a J2K image even though it appears in many respects, for the convenience of the user, to be a Manifold image.  


To link a J2K format file:


  1. Choose File-Link from the main menu.

  2. In the Link dialog browse to the folder containing data of interest.

  3. Click the .j2k file desired.

  4. Click the Options button.

  5. In the Options button choose the cache options desired, for example unchecking the Save cached data... option to keep file size small.

  6. Press Open.  A linked data source will appear in the project.

  7. Press the + icon next to the data source to expand the data source to see the image it contains.




The  Options dialog allows setting cache options.




Most often when linking to a format like J2K, which is fast for links, we will ensure the Save cached data between sessions box is not checked.    We click OK and then back in the Link dialog we click Open.




That creates a data source that contains an image and the image's table in our project.  We can double-click on the image to open it.




In theory, J2K files can provide projection information.   In practise, we often must manually specify projection information for J2K files by launching Assign Initial Coordinate System in the Contents pane.


When we want to do more than just viewing, and to work with images using the full power of Manifold, we can import a J2K as a Manifold image.  


Importing a J2K into Manifold decompresses the image into the full content of all pixels for the height and width of the image.  That can be very many pixels as images that are tens of thousands of pixels high and wide are commonly found in J2K format.   


Caution: Importing a large J2K file can take a few minutes or more, and then saving the project that contains a large imported image can also take a significant amount of time.   However, once the import is accomplished and the project has been saved, thereafter the project will open instantly.  


Important: When importing a J2K file the image that appears in the Manifold project is a native Manifold image with no further connection to the J2K file from which it was imported.   It is a native Manifold image and no longer is a J2K image.  


To import from J2K format:


  1. Choose File-Import from the main menu.

  2. In the Import dialog browse to the folder containing data of interest.

  3. Double-click the .j2k file desired.

  4. An image and the image's table will be created in the project.  




Double-clicking on a .j2k file in the Import dialog as seen above will create an image and the image's table in our project.




We can double-click on the image to open it.




The image is one of the JPEG 2000 images assembled in a mosaic for display on the Gallery page, with a full sized mosaic image shown on that page.



Historical images - The Library of Congress in the US provides many scanned historical documents, such as historical maps, in JPEG 2000 format for free download.   The image below shows a historical map of the Civil War battle of Gettysburg drawn in 1863 shortly after the battle.  




SDKs Used - Manifold includes the Hexagon SDK for ECW and the LizardTech SDK for MrSID.  Both companies have included JPEG 2000 support within their SDK, but both SDKs have issues, albeit different issues.  Which SDK is used by Manifold depends on the SDK build, with each new Manifold build choosing which of the two SDKs has fewer issues at the time of publication.

See Also

Assign Initial Coordinate System