KB10807 - When using the DK ExportToImage method to generate a PixelStore image, what parameters and image capabilities must be considered?
A PixelStore image is one "virtual" tiled image, with each of the 512 x 512 pixel tiles organized into a SQL database hierarchy. The tiles within each PixelStore image reflect a subformat. The subformats options, and the capabilities of each, are:
- PixelFormat = pf24bit; GrayScale = false; Subformat = 0; gisCompressionTypeJPEG
- PixelFormat = pf8bit; GrayScale = true; Subformat = 1; gisCompressionTypeJPEG
- PixelFormat = pf24bit; GrayScale = false; Subformat = 100; gisCompressionTypePNG
- PixelFormat = pf8bit; GrayScale = false; Subformat = 101; gisCompressionTypePNG
- PixelFormat = pf1bit; GrayScale = false; Subformat = 102; gisCompressionTypePNG
- PixelFormat = pfCustom; GrayScale = false; Subformat = 103; gisCompressionTypeNONE
The 24 bit JPEG subformat, of course, of course is for compression of aerial images containing an unlimited number of colors. The 8 bit JPEG subformat provides better compression for grayscale images. The PNG format options provide “lostless” compression for images with a limited number colors – such as scanned raster map. (The 1 PNG option provides for best compression of black/white raster maps.) The number 103 subformat option( without compression) is appropriate for maximum image quality (no quality loss from compression) when file size is not an issue. This option is also appropriate for the export of grid data to a PixelStore layer.
When exporting an image from the DK Viewer to any raster format file, the image capabilities are set using the ExportToImageCapabilities method. The code to preview the capability items is:
var
lstp : TGIS_PixelCapabilities ;
lst : TObjectList ;
i : Integer ;
begin
lst := GIS.ExportToImageCapabilities( ‘MyRasterFile.ext’ ) ;
for i := 0 to lst.Count - 1 do begin
lstp := TGIS_PixelCapabilities( lst.Items[i] );
// lstp keeps PixelFormat, GrayScale, Subformat, Compression properties
end;
Then set valid parameters for the image export using the GIS.ExportToImage method:
_path: path to the output file
_extent: extent of the source image to be exported
_width: width of the output image (If 0, the calculation is based on _height and _extent proportion.)
_height: height of the output image (If 0, the calculation is based on _height and _extent proportion)
_compression: compression level of the output image; applicable to PNG, JPEG, JPEG2000, wavelet compression. (A JPEG compression setting of 0 means the most possible compression, resulting in the most reduction in the file size and greater loss of image quality. A JPEG compression level of 100 means the least possible compression, resulting the least reduction in the file size and less loss of image quality. A PNG compression setting of 0 means the most possible compression, resulting in the most reduction in file size and slower rendering speed. A PNG compression setting of 100 means the least possible compression, resulting in the least reduction in file size and faster rendering speed.
_subformat: sub-format number (A number corresponds to each subformat and capabilities. Use ExportToImageCapabilities() to obtain a list of supported subformats. Use 0 to get the default subformat.)
_dpi: density of output image (This is used to calculate the feature size and is embedded into the final image whenever possible.)
Created: 2009-03-11, Modified: 2009-03-12