DynaPDF Manual - Page 540

Previous Page 539   Index   Next Page 541

Function Reference
Page 540 of 839
It is also the best compression filter for images with color depths less than 8 bits (except 1 bit). 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. These filter
are relatively fast and achieve good compression rates. However, JBIG2 compression achieves much
higher compression rates! Therefore, these filters should no longer be used.
JBIG2 is a lossless compression filter for 1 bit b/w images. It achieves on average 1.5 to 8 times
higher compression rates than CCITT Fax G4 and it is relatively fast. This filter should be used by
default for 1 bit black & white images. JBIG2 supports also a lossy compression method but this
mode is not implemented in DynaPDF because errors in the resulting image are usually not
JPEG Encode
JPEG is a lossy compression method which produces very good compression rates for color and
gray scale images. It can be used in combination with all supported color spaces. The compression
ratio and resulting quality can be adjusted with SetJPEGQuality(); the default quality is 70%.
JPEG images are inserted in pass-through mode if the image resolution is lower or equal to the
specified resolution (see SetResolution()) and if the image color space matches the destination color
space. DynaPDF removes embedded ICC profiles also in pass-through mode since PDF readers do
not use such profiles when displaying an image. See Embedded ICC profiles below for further
The image scaler can be disabled with SetSaveNewImgageFormat(). It is also possible to explicitly
disable the pass-through mode by setting the JPEG quality to a negative value. The image will be re-
compressed in this case. This can be useful if a higher compression ratio should be achieved.
Real pass-through mode
JPEG images are rebuild by default, also in pass-through mode, to avoid issues with certain
malformed images which cannot be displayed in Adobe's Acrobat or Reader and to remove
embedded ICC profiles.
The image is not re-compressed when rebuilding the image structure but this action requires some
processing time which can be avoided when it is known that the image is already Adobe Acrobat or
Reader compatible and if the image contains no embedded ICC profile. To enable real pass-through
mode set the flag gfRealPassThrough with SetGStateFlags(). The processing speed will be significantly
improved in this case.

Previous topic: How to get the image format?, Color spaces, How to change the color depth?, Duplicate check, Compression Filters, Flate Encode

Next topic: Embedded ICC profiles, Optimized Huffmann encoding, JPEG 2000, Setting the image quality