Xojo Conferences
MBSOct2019CologneDE

DynaPDF Manual - Page 492

Previous Page 491   Index   Next Page 493

Function Reference
Page 492 of 770
mode is not implemented in DynaPDF because errors in the resulting image are usually not
acceptable.
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.
 

Previous topic: How to get the image format?, Color spaces, How to change the color depth?, Duplicate check, Compression Filters, Flate Encode, CCITT Fax G3/4, JBIG2

Next topic: JPEG 2000 (Experimental)