DynaPDF Manual - Page 155

Previous Page 154   Index   Next Page 156

Function Reference
Page 155 of 839
component order BGR. This conversion must be considered if the image buffer should be passed to
another function.
Windows Bitmaps require also double word aligned scanlines while all other image formats support
byte aligned the scanlines. AddRasImage() adds required fill bytes automatically to achieve the line
alignment. However, to increase conversion speed the image buffer should consider the scaline
alignment of the output image format if possible.
TIFF is the one and only multi-page image format. All other image formats support exactly one
image. The image must be closed with CloseImage() when finish.
1 bit image output
If the pixel format of the rasterizer was set pxfGray, it is possible convert the image buffer to 1 bit
black & white with ordered dithering, Floyd Steinberg dithering, or with the Otsu filter. The Otsu
filter is a special filter that avoids anti-aliasing artifacts. It produces true black & white output and
does not try to simulate gray shades by dithering areas of an image. This filter is optimal if the
resulting image should be passed to an OCR engine.
There are two ways to apply the Floay Steinberg dithering algorithm: either combine the flag
cfDitherFloydSteinberg with the compression filter you want to use:
TCompressionFilter(cfFlate | cfDitherFloydSteinberg)
or use one of the filters cfCCITT3/4, cfLZWBW or cfFlateBW. These constants were already defined
in DynaPDF 3.0. However, in future we use separate flags for such things because it is more flexible.
The Otsu filter or ordered dithering can be enabled in the very same way:
TCompressionFilter(cfFlate | cfConvGrayToOtsu)
or
TCompressionFilter(cfFlate | cfOrderedDithering)
Compression filters
The compression filter is considered only for TIFF output because all other image formats support
only one specific filter. The compression filter must be compatible to the pixel format. For example,
CCITT Fax compression is compatible to 1 bit images, it is not supported for gray or color images.
The function is able to create up to 4 GB large TIFF image files. Depending on the used compression
filter and compression ratio this is mostly enough to create TIFF images with up to 8000 RGB pages
in a resolution of 300 DPI. However, the maximum number of pages depends on the resolution,
compression ratio and pixel format.
The JPEG Quality and compression level can be adjusted with SetJPEGQuality() and
SetCompressionLevel() before calling the function.
 

Previous topic: AddRasImage (Rendering Engine)

Next topic: Embedding ICC Profiles, AddRenderingIntent (obsolete), AddRenderingIntentEx (obsolete), AddValToChoiceField