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.
Export: When exporting to J2K / JPEG 2000, Manifold writes image offset and scale info into the image file as well as projection information into the accompanying files. When exporting, .prj and .mapmeta files are written. See the Exporting topic.
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:
Choose File-Link from the main menu.
In the Link dialog browse to the folder containing data of interest.
Click the .j2k file desired.
Check or uncheck the Save cache box as desired.
Press Link. A linked data source will appear in the project.
Press the + icon next to the data source to expand the data source to see the image it contains.
The Save cache box allows setting cache options.
Most often when linking to a format like J2K, which is fast for links, we will ensure the Save cachebox is not checked. We click Link.
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 Component pane.
When linking a J2K file we can alter the coordinate system and Style the image, changing channel assignments and how channels are interpreted. The data within the J2K remains unchanged, but Manifold will dynamically, on-the-fly re-project and re-interpret the data in the new Style as desired.
For example, to create the display above we have used the Style pane to treat the J2K not as a three-channel RGB image but as a single channel image, forcing use of Channel 0 as a single index channel to drive the display based on a palette, as shown. We have also clicked the Options tab to apply hill shading. This is nuts, of course, since the image is a photographic image and not terrain elevation data. But we can interpret it as if it was intended to be terrain elevation data to create the display seen above.
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:
Choose File-Import from the main menu.
In the Import dialog browse to the folder containing data of interest.
Double-click the .j2k file desired.
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.
Assign Initial Coordinate System