Converting file formats
The RasterMaster Java products support over 99 file formats. Many formats such as TIFF are very broad in the internal support of compression and bit depths.
Note: Not all formats can support all bit depths.
All RasterMaster Java products import and convert file formats to RasterMaster’s internal format at decompress time. The format is a simple uncompressed DIB (Device Independent Bitmap) format stored in memory. This format is decompressed or imported and can be saved out to any supported format.
See Supported File Formats for a complete list of supported file formats. For more information on the DIB format, please see MS Windows DIB Header Format.
Automatically Detecting File Formats
In most cases, you do not need to know the file format you wish to convert since RasterMaster Java products automatically detect the file format regardless of the file extension. File extensions are not mandatory.
RasterMaster Java supports automatic promotion of images to destination files. For example, JPEG images can only be written out at 8 and 24-bits per pixel. In order to save a 1-bit TIFF image as JPEG, the developer must promote the TIFF to 8 or 24-bits per pixel.
In our other libraries, this is accomplished by calling one of the promote functions. In RasterMaster Java, however, the library automatically determines the bits per pixel for the destination format and promotes accordingly.
Supported Pixel Depths
JPEG supports 8, 24, and 32-bits per pixel. Black and white images use 1-bit per pixel, while color images usually require 24-bits per pixel. For many of these cases, RasterMaster Java automatically converts the pixel depth to the appropriate value, based on the output format specified.
See the Single Conversion sample to view a sample of decompressing and saving an image to another format.
Converting Up 8 or 24-bit Pixel Depths
To convert any pixel depth up to 24-bit, use IMG_promote_24
. For more information, please see the RasterMaster Java API.
See Supported File Formats for the pixel depths of each supported format.
For more information on converting from a higher pixel depth format to a lower pixel depth format or a lower pixel depth format to a higher pixel depth, please see Color Manipulation Methods.
File Format Conversion Error Messages
When saving to a format, if the error returned is PIXEL_DEPTH_UNSUPPORTED (-21)
, the output format does not support the current bits per pixel of the image you are trying to save. It is possible to convert the pixel depth of these images using the IMG_promote_24
method. See IMG_promote_24(void)
(#) for more information.
See Supported File Formats for the pixel depths of each supported format.
Extracting Text
RasterMaster supports extracting text to an ASCII file for some popular formats such as PTOCA, PCL, PDF, MS Word, AFP, and MS Excel. Please see IMGLOW_extract_text (String, int, int, int)
in the RasterMaster Java APIfor more information.
Have questions, corrections, or concerns about this topic? Please let us know!