File: compress.txt Date: 04/06/92 LEADTOOLS Supported File Formats: --------------------------------- ------------------------------------------------------------------------- | File | Bits | Compression | QFactor | | Format | Supported | Format | Supported | ------------------------------------------------------------------------- | JFF | 24 | JPEG & | 2 - 255 | | | | LEAD-JFF | | ------------------------------------------------------------------------- | JTF | 24 | JPEG & | 2 - 255 | | | | LEAD-JTF | | ------------------------------------------------------------------------- | CMP | 24 | LEAD | 2 - 255 | | | | | & Enhanced | | | | | PQ or PQ1, QMS, QS | | | | | SQS, SQT, MCQ, MC | ------------------------------------------------------------------------- | TGA | 8, 16, 24, 32 | uncompressed | | | | | & RLE | | ------------------------------------------------------------------------- | TIF | 1, 4, 8, 16 | uncompressed | | | | | & LZW | | ------------------------------------------------------------------------- | BMP | 4, 8, 24 | uncompressed, | | | | | Windows, RLE, & | | | | | Presentation Manager | | ------------------------------------------------------------------------- | PCX | 1, 4, 8 | compressed | | ------------------------------------------------------------------------- | GIF | 1, 4, 8 | LZW | | ------------------------------------------------------------------------- LEAD Technologies is always adding new file support to all products. Please contact LEAD for availability of new versions of LEADTOOLS that will support new file formats. JPEG and LEAD-JPEG ------------------ LEADTOOLS supports two formats of JTIF(JPEG TIF) and two formats of JFIF(JPEG File Interchange format). Discusion here applies to either formats. LEADTOOLS can store two versions of JFIF file and two versions of JTIF file. One version is the orginal generic JPEG streem format. The second version contains addtional color space conversion to produce smaller file size. Both are still JPEG complient file formats. LEADTOOLS's JPEG formats are JFIF, LEADJFIF, JTIF, and LEADJTIF. The new additions are LEADJFIF and LEADJTIF and are both fully compatable with most commercial JPEG viewers. The advantage of using LEAD-JFIF and LEAD-JTIF is to produce a smaller compressed file size. LEAD Conversion and Compression Process --------------------------------------- In compliance to JPEG specifications, the LEADTOOLS compression will take an image to 24-bit per pixel regardless of the original bits per pixel. For example, if you try to compress an 8-bit image to a LEAD, LEADJFIF, JFIF, LEADJTIF or JTIF formats, LEADTOOLS will first convert the image to 24-bits per pixel before starting the compression process. A 24-bit TGA file is the fastest format for LEADTOOLS to compress and decompress. Compressing a 16-bit TGA file is also a fast conversion process for LEADTOOLS. When you compress an image in the LEAD format, you can store the palette to get the best colors for the 8-bit VGA screen. Also, when displaying the image to a 24-bit display device, the palette is ignored and the original 24-bit color information will be displayed. When displaying to an 8-bit VGA screen, LEADTOOLS will use this palette to get the best 256 colors to display the file. When compressing to a CMP format, use the pre-defined QMS (Quality More Important that Size) option. For JFF or JTF format, start with a QFactor of 30 and work up or down until you get the desired result. The CMP format will give you better image quality and a smaller file size than JFF or JTF. Decompression ------------- LEADTOOLS decompresses the quickest to 16-, 24-, or 32-bit file formats. When decompressing to an 8-bit file, LEADTOOLS must go through an optimization process to obtain the best 256 colors for the image. This will slow the decompression process. When LEADTOOLS decompresses a file, it will first decompress to a 24-bit RGB format and then convert the file to the desired format (GIF, TIFF, etc). If only and 8-bit color VGA is used for displaying images, we recommend you store the VGA palette with the image. By doing so, LEADTOOLS will not have to create a new palette every time the image is displayed to the 8 bit VGA screen. This process is called optimization. By saving the palette with the image, the file will be 796 bytes larger than saving it without the palette optimization; but having saved the palette, the decompression to an 8-bit VGA will be much faster. Alpha Channel ------------- The Alpha Channel is the 8-bit portion of a 32-bit TGA file that defines the blend and the overlay. The alpha channel is stored with the associated compressed file name. The alpha channel will have the same filename as the compressed file but with the .ALF extension. You can have the same alpha channel name associated with a different TGA file by renaming or copying the .ALF file as the same compressed file name (e.g. MYFILE.CMP and MYFILE.ALF). If you decompress the image back to a 32-bit TGA file and want to restore the alpha channel, make sure both files are in the same directory. If the .ALF file is not present, LEADTOOLS will fill the alpha channel with zeroes. If you have no use for the blend or overlay capability, do not save the alpha channel; not saving the alpha channel will have no affect on the image quality. When To Save the VGA Palette with LEAD compressed file format. --------------------------------------------------------------- If your applications are only for 8 bit color VGA users or both 8-bit color and higher, we recommend that you save the VGA palette along with the compressed file. By doing so, LEADTOOLS will not have to create and optimize a new palette table every time the file is displayed. This avoids adding time to the decompression process while a new palette is created every time the file is decompressed or displayed. Actual time taken also varies according to the image size. However, decompressing to the VGA screen will be faster if palette was created and stored in the compressed file. Sice most files are decompressed more times than compressed adding the time to the compression process and saving the palette is more productive than saving time during compression and not saving the VGA palette but creating one every time the file is viewd. File Format Conversion ---------------------- LEADTOOLS gives you the ability to convert to and from many graphics file formats. Keep in mind that when you convert a 32-bit or 24-bit file downto a 16-bit or lower, you will loose color in the conversion process because there are less available colors. As a result, the colors in the newly converted file will not be exactly the same as the original 24-bit or 32-bit. LEADTOOLS does try to optimizes the colors during the conversion process but some loss of color is unavoidable.