You are here: NITF Images > Creating NITF Files

Creating NITF* Files

To create a NITF file, use the -outputformat switch with either nitf or nitfjp2 as the output type. nitf specifies a raw (uncompressed) output file, whereas nitfjp2 indicates that the NITF file will be encoded as a JPEG 2000 file. The NITF metadata fields can be set by using the -nitfmetadata switch and supplying a specially formatted text file. The format of the text file is: [code]:[value], where [code] is the six-letter field name as defined in the NITF 2.1 spec and [value] is the actual data that the field contains. Only one field is allowed per line, and the [value] portion cannot contain new line characters or span multiple lines. The image segment can contain up to nine Image Comment fields, named "ICOM1" through "ICOM9".

*Support for encoding NITF images is available for GeoExpress. Contact your LizardTech representative to purchase the NITF Extension for GeoExpress.

Example

Following is an example of a NITF metadata text file:

OSTAID:LizardTech
FDT:20041106071325
FTITLE:File title
ONAME:John Smith
OPHONE:555-123-4567
FSCLAS:U
FSCLSY:
FSCODE:codewords
FSCTLH:
FSREL:
FSDCTP:
FSDCDT:
FSDCXM:
FSDG:
FSDGDT:
FSCLTX:
FSCATP:
FSCAUT:
FSCRSN:
FSSRDT:
FSCTLN:
IID1:Image ID
IDATIM:20030401120059
TGTID:
IID2:
ISORCE:
ICOM1:Image segment comment 1
ICOM2:Image segment comment 2
ICOM3:Image segment comment 3
ISCLAS:U
ISCLSY:
ISCODE:image code
ISCTLH:
ISREL:
ISDCTP:
ISDCDT:
ISDCXM:
ISDG:C
ISDGDT:
ISCLTX:image classification text
ISCATP:
ISCAUT:image classification authority
ISCRSN:
ISSRDT:
ISCTLN:

Putting all the above together, the following example shows how you would create a simple uncompressed NITF file on the command line:

mrsidgeoencoder -i foo.tif -o foo.ntf -of nitf -nitfmetadata MyNITFMetadata.txt

For a JPEG 2000 encoded NITF file, all of the normal JPEG 2000 encoding options apply. For example:

mrsidgeoencoder -i foo.tif -o foo.ntf -of nitfjp2 -nitfmetadata MyNITFMetadata.txt -cr 20 -tilesize 512 512 -porder LRCP

This NITF metadata text file format can be extended to target specific image segments by using the -<index> identifier after the field name. For example, to set the image subheader fields for image segment 2, you could enter:

...

IID1-2:Image ID

IDATIM-2:20030401120059

TGTID-2:

IID2-2:

ISORCE-2:

ICOM1-2:Image segment comment 1

ICOM2-2:Image segment comment 2

ICOM3-2:Image segment comment 3

ISCLAS-2:U

...

For information on how GeoExpress handles existing NITF metadata, see NITF* Input Metadata.