Djpegb takes as input a file containing a Baseline JPEG (JPEGB) compressed grayscale or color image. Once read into memory, the lossy-compressed pixmap is decoded and reconstructed using the Independent JPEG Group's (IJG) library for Baseline JPEG.
Upon completion, two different output image file formats are possible, a NIST IHead file (the default) or a raw pixmap file (specified by the -raw_out flag). In addition, a specially formatted text file, called a NISTCOM, is created with extension ".ncm". The NISTCOM file contains relevant image attributes associated with the decoded and reconstructed output image. (See NISTCOM OUTPUT below.)
All switch names may be abbreviated; for example, -raw_out may be written -r.
the extension of the decompressed output file. To construct the output filename, djpegb takes the input filename and replaces its extension with the one specified here.
the input JPEGB file to be decompressed.
specifies that the decoded and reconstructed image should be stored to a raw pixmap file.
specifies that the color components in the reconstructed image should be organized into separate component planes. The -raw_out flag must be used with this option, because the IHead format only supports interleaved color pixels. (See INTERLEAVE OPTIONS below.)
For example, given an RGB image, its color components may be interleaved or non-interleaved. Color components are interleaved when a pixel's (R)ed, (G)reen, and (B)lue components are sequentially adjacent in the image byte stream, ie. RGBRGBRGB... . If the color components are non-interleaved, then all (R)ed components in the image are sequentially adjacent in the image byte stream, followed by all (G)reen components, and then lastly followed by all (B)lue components. Each complete sequence of color components is called a plane. The utilities intr2not and not2intr convert between interleaved and non-interleaved color components. By default, djpegb uses interleaved color component pixels in the reconstructed output image. Note that all color IHead images must be interleaved.
Upon successful completion, djpegb, creates a specially formatted text file called a NISTCOM file. A NISTCOM is a text-based attribute list comprised of (name, value) pairs, one pair per text line. The first line of a NISTCOM always has name = "NIST_COM" and its value is always the total number of attributes included in the list. These attributes are collected and merged from two different sources to represent the history and condition of the resulting reconstructed image. The first source is from an optional NISTCOM comment block inside the JPEGB-encoded input file. This comment block can be used to hold user-supplied attributes. The JPEGB encoder, cjpegb, by convention inserts one of these comment blocks in each compressed output file it creates. (The utility rdjpgcom can be used to scan a JPEG file for any and all comment blocks.) The second source of attributes comes from the decompression process itself. In general, attribute values from this second source are given precedence over those from the first.
The NISTCOM output filename is constructed by combining the basename of the input JPEGB file with the extension ".ncm". By creating the NISTCOM file, relevant attributes associated with the decoded and reconstructed image are retained and easily accessed. This is especially useful when dealing with raw pixmap files and creating image archives. The following is an example NISTCOM generated by djpegb:
NIST_COM 10 PIX_WIDTH 768 PIX_HEIGHT 1024 PIX_DEPTH 24 PPI -1 LOSSY 1 COLORSPACE RGB NUM_COMPONENTS 3 HV_FACTORS 1,1:1,1:1,1 INTERLEAVE 1
From test/imgtools/execs/djpegb/djpegb.src:
% djpegb raw face24.jpb -r decompresses a JPEGB-encoded RGB face image and stores the reconstructed image to a raw pixmap file. Note the NISTCOM file, face24.ncm, is also created.