Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

DynaPDF Manual - Page 478

Previous Page 477   Index   Next Page 479

Function Reference
Page 478 of 750
How to get the image format?
The most important image parameters such as width, height, bits per pixel and the default
compression filter can be retrieved with the function ReadImageFormat() or ReadImageFormatEx().
Color spaces
The handling of image color space is described in detail at Color Spaces and Images.
How to change the color depth?
DynaPDF can reduce the color depth of true color images to 256 color images. The color depth will
be changed if the default color depth was set to 8 bit per pixel and if the used compression filter is
Flate. The default color depth can be changed with the function SetDefBitsPerPixel().
Duplicate check
The function performs by default a duplucate check so that the same image can be inserted multiple
times without increasing the resulting PDF file size. For file based images the function compares the
file name and the output parameters like the scaled width and height, transparency settings and so
on. For memory based images the entire image buffer is taken into account. The required processing
time for the duplicate check is therefore considerable higher for memory based images.
However, the duplicate check for file based images can lead to wrong results, e.g. if the application
creates temporary images with the same file name. In such cases it is possible to disable the duplicate
check with the flag gfNoImageDuplCheck. The flag can be set with SetGStateFlags().
Compression Filters
At time of publication DynaPDF supports Flate, CCITT Fax G3, CCITT Fax G4, JPEG, and JPEG2000
compression. The compression filter can be individually set with SetCompressionFilter().
Flate Encode
Flate encode (also called zip compression) is a loss-less compression filter. It can be used with all
supported color spaces. It produces good compression ratios for images with large uniform surfaces.
It is also the best compression filter for images with color depths less than 8 bits. The compression
level can be adjusted with the function SetCompressionLevel().
CCITT Fax G3/4
CCITT Fax G3 and G4 compression are lossless compression filters for 1 bit b/w images. The filter
produces very good compression rates on typical fax images which contain much text. It is very fast
but less flexible in comparison to flate. For example, dithered images produce often a drastical
expansion instead of a compression. CCITT Fax G3 and G4 compression can be used on known
image types, typically fax input, but it should not be used as a default filter for b/w images.
 

Previous topic: Supported image formats

Next topic: Optimized Huffmann encoding