The READ_JPEG procedure reads JPEG (Joint Photographic Experts Group) format compressed images from files or memory. JPEG is a standardized compression method for full-color and gray-scale images. This procedure reads JFIF format files (often called "JPEG" files), including those produced by WRITE_JPEG.
READ_JPEG can optionally quantize true-color images contained in files to a pseudo-color palette with a specified number of colors, and with optional color dithering.
This procedure is based in part on the work of the "Independent JPEG Group". For a brief explanation of JPEG, see WRITE_JPEG .
Set this keyword to a named variable that is used for a buffer. A buffer variable need only be supplied when reading multiple images per file. Initialize the buffer variable to empty by setting it to 0.
If the image file contains a true-color image that is to be displayed on an indexed color destination, set COLORS to the desired number of colors to be quantized. COLORS can be set to a value from 8 to 256. The DITHER and TWO_PASS_QUANTIZE keywords affect the method, speed, and quality of the color quantization. These keywords have no effect if the file contains a grayscale image.
Set this keyword to use dithering with color quantization (i.e., if the COLORS keyword is in use). Dithering is a method that distributes the color quantization error to surrounding pixels, to achieve higher-quality results. Set the DITHER keyword to one of the following values:
JPEG/JFIF images are normally written in top-to-bottom order. If the image is to be stored into the Image array in the standard IDL order (from bottom-to-top) set ORDER to 0. This is the default. If the image array is to be top-to-bottom order, set ORDER to 1.
Use this keyword to specify the index of the dimension for color interleaving when reading a true-color image. The default is 1, for pixel interleaving, (3, m , n ). A value of 2 indicates line interleaving ( m , 3, n ), and 3 indicates band interleaving, ( m , n , 3).
Set this keyword to use a two-pass color quantization method when quantization is in effect (i.e., the COLORS keyword is in use). This method requires more memory and time, but produces superior results to the default one-pass quantization method.
This keyword can be used to designate the logical unit number of an already open JFIF file, allowing the reading of multiple images per file or the embedding of JFIF images in other data files. When using this keyword, Filename should not be specified.