Output documents and images
This chapter describes how to output an image or document to a different file format and the available save methods for the Snow.Snowbnd
class.
Image Compression
This section describes compressed images.
Preferred Formats
Most of the compression algorithms only compress a specific type of image data. Compression techniques for 24-bit color images usually do not work well on 1-bit or bi-level images. Similarly, compression for 1-bit images do not compress well for 24-bit color images.
24-Bit Color Images
For 24-bit color images, use the JPEG format in RasterMaster Java for the best conversion results.
8-Bit Gray Scale Images
For 8-bit gray scale images, use the JPEG format in RasterMaster Java for the best conversion results.
1-bit Bi-Level Images
For 1-bit bi-level images, use the TIFF G4 in RasterMaster Java for the best conversion results. The JBIG format works about twenty percent better than the TIFF G4 format, but it can be much slower.
Saving multi-page documents and images
This section describes how to save and convert multi-page images in RasterMaster Java.
Multi-page Images
All RasterMaster libraries decompress a single page at a time. This section describes the multi-page formats and how to decompress, determine page count, and save multi-page images.
Supported Multi-page Formats
RasterMaster Java currently supports the following multi-page formats:
- TIFF
- MO:DCA/IOCA
- PCL
- MSWord-Reading
- MSExcel-Reading
- RTF-Reading
Decompressing a Multi-page Image
Each page must be decompressed then saved separately. In other words, a decompress then save must be performed for each page.
Determining Multi-page Page Count
You can keep decompressing pages until a PAGE NOT FOUND
or -11 error
is returned from the decompress method, or you can query the number of pages with the IMGLOW_get_pages
method.
Saving Multi-page File Formats
When saving to a multi-page file format, keep in mind that all RasterMaster Java products append or add new pages to an image file if the file already exists. If you do not want to keep saving to the same file, you must first delete the page or save each page to a unique file name
Methods Used for Multi-page Format Methods
Table 5.7: Supported Multi-page Methods
Method | Description |
---|---|
IMGLOW_get_pages() |
Detects the number of pages in a file. |
IMG_decompress_bitmap() |
Reads pages and specifies the specific page to import. |
IMG_save_bitmap() |
Saves multi-page images. For an existing file, new pages are appended. For new files, new pages with the specified name are created as necessary. Note: Use a unique filename when saving to multi-page formats, otherwise, images are automatically appended to any file with the same name |
Changing the DPI in the RasterMaster SDK Library
This section describes how to change the DPI in the RasterMaster® SDK library. Changing the DPI in the RasterMaster® SDKLibrary
When the library decompresses an image, it is converted into an MS-Windows device independent bitmap (DIB), which contains a header for the width, height, and also the dots per inch.
To change or look at the DPI information from an image use the following code:
int xDPI, yDPI;
xDPI = Simage.getXdpi();
yDPI = Simage.getYdpi();
if (xDPI < 300 || yDPI < 300)
{
Simage.setXdpi(300);
Simage.setYdpi(300); }
Have questions, corrections, or concerns about this topic? Please let us know!