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

DynaPDF Manual - Page 479

Previous Page 478   Index   Next Page 480

Function Reference
Page 479 of 750
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
information.
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.
Embedded ICC profiles
JPEG images can contain embedded ICC profiles but PDF readers ignore such profiles. However,
DynaPDF can extract the embedded ICC profile to create an ICC based color space for the image. To
enable the usage of embedded ICC profiles set the flag gfUseImageColorSpace with SetGStateFlags().
See also Color Spaces and Images. The embedded ICC profile will be removed from the image
stream so that no unnecessary data must be stored in the PDF file.
Note that embedded ICC profiles will not be removed if real pass-through mode is enabled.
Especially embedded CMYK profiles are very large and should be removed if possible. Real
pass-through mode should be disabled in this case.
Optimized Huffmann encoding
Images are compressed with optimized Huffmann tables if the current compression level is set to
clMax (see SetCompressionLevel()). This level produces better compression ratios without loosing
quality. However, the optimized compression method is minimal slower than the normal one.
JPEG images are inserted in path-through mode if either the property SetSaveNewImageFormat() is
set to false (default = true) or if no further conversion or downscaling is required.
 

Previous topic: CCITT Fax G3/4

Next topic: Why does DynaPDF not support LZW compression?