rgb2ycc <outext><imagefile>
[ -raw_in w,h,d, [ppi] [-nonintrlv ]] [-YCbCr H0,V0:H1,V1:H2,V2]
Rgb2ycc takes as input a file containing an uncompressed color RGB image. Two possible input file formats are accepted, NIST IHead files and raw pixmap files. If a raw pixmap file is to be converted, then its image attributes must be provided on the command line as well. Once read into memory, the RGB pixmap is converted to the YCbCr colorspace. The results are always written to a raw pixmap file because the NIST IHead file format only supports interleaved RGB images.
The color components of RGB pixels in a raw pixmap file may be interleaved or non-interleaved. By default, rgb2ycc assumes interleaved color pixels. (See INTERLEAVE OPTIONS below.)
If requested, rgb2ycc also conducts downsampling of the YCbCr component planes. By default, this utility does no downsampling. Regardless of downsampling, the conversion from RGB to YCbCr and back to RGB will not result in the same exact image. Some pixels values will be slightly perturbed due to the round-off of the floating point transformations that are applied. (See YCbCr OPTIONS below.)
All switch names may be abbreviated; for example, -raw_in may be written -r.
the extension of the YCbCr output file. To construct the output filename, rgb2ycc takes the input filename and replaces its extension with the one specified here.
the input file, either an IHead file or raw pixmap file, containing the color RGB image to be converted.
the attributes of the input image. This option must be included on the command line if the input is a raw pixmap file.
the pixel width of the pixmap
the pixel height of the pixmap
the pixel depth of the pixmap
the optional scan resolution of the image in integer units of pixels per inch.
specifies that the color components in an input raw pixmap file image are non-interleaved and stored in separate component planes. (See INTERLEAVE OPTIONS below.)
this option, if provided on the command line, directs rgb2ycc to conduct downsampling of the YCbCr component planes. If all the H,V factors are set to 1 then no downsampling is done; this is equivalent to ommiting the option. (See YCbCr Options below.)
The color components of RGB pixels in a raw pixmap file 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, rgb2ycc assumes interleaved color components, and note that all color IHead images must be interleaved.
Rgb2ycc converts color RGB images to the YCbCr colorspace. A common compression technique for YCbCr images is to downsample the Cb & Cr component planes. Rgb2ycc conducts a limited range of YCbCr downsampling schemes that are represented by a list of component plane factors. These factors together represent downsampling ratios relative to each other. The comma-separated list of factor pairs correspond to the Y, Cb, and Cr component planes respectively. The first value in a factor pair represents the downsampling of that particular component plane in the X-dimension, while the second represents the Y-dimension. Compression ratios for a particular component plane are calculated by dividing the maximum component factors in the list by the current component's factors. These integer factors are limited between 1 and 4. H,V factors all set to 1 represent no downsampling. For complete details, rgb2ycc implements the downsampling and interleaving schemes described in the following reference:
W.B. Pennebaker and J.L. Mitchell, "JPEG: Still Image Compression Standard," Appendix A - "ISO DIS 10918-1 Requirements and Guidelines," Van Nostrand Reinhold, NY, 1993, pp. A1-A4.
For example the option specification:
-YCbCr 4,4:2,2:1,1
directs rgb2ycc to not downsample the Y component plane (4,4 are the largest X and Y factors listed); the Cb component plane will be downsampled in X and Y by a factor of 2 (maximum factors 4 divided by current factors 2); and the Cr component plane will be downsampled in X and Y by a factor of 4 (maximum factors 4 divided by current factors 1). Note that downsampling component planes is a form of lossy compression. The utility ycc2rgb takes the YCbCr results and converts them back to the RGB colorspace. If downsampling was applied to the YCbCr components, then the downsampled planes are up-sampled prior to conversion to RGB. Note that even without dowsampling, the conversion from RGB to YCbCr and back to RGB will not result in the same exact image. Some pixels values will be slightly perturbed due to the round-off of the floating point transformations that are applied.