DynaPDF Manual - Page 629

Previous Page 628   Index   Next Page 630

Function Reference
Page 629 of 883
Special compression filter flags:
The compression filter members of the structure TOptimizeParms can be combined with the flags
cfPresLosslessFilter and cfPresLossyFilter to preserve the original compression filter. If both flags are
set, the image is compressed with the original compression filter.
The flags can be combined with a compression filter constant with a binary or operator:
Example (C/C++):
p.FilterGray = (TCompressionFilter)(cfJPEG | cfPresLossyFilter);
The above filter definition means compress gray images with JPEG unless the image uses a lossless
compression filter.
If no compression filter constant is set, cfFlate is used as alternate filter.
Image size check
The flag ofNoImageSizeCheck is implicitely set if a color conversion flag is set. This makes sure that
images can be converted to another color space also if the new image becomes larger. This is usually
always the case when converting images to CMYK from a lower color space.
Converting gray images to 1 bit (black & white)
Gray images will be converted to 1 bit b&w if the flag ofConvertGrayTo1Bit is set. The flag is
considered only if the flag ofCompressWithJBIG2 is set or if the parameter Parms and the flag
ofScaleImages is set. The conversion of gray images to b&w is mainly useful for scanned faxes since
many scanners create gray images for b&w input.
Optimize() supports the Floyd-Steinberg dithering, Ordered dithering, as well as the special filter
Otsu and Sauvola. The latter ones are very useful if the images should be passed to an OCR engine
afterwards since these filters are able to remove anti-aliasing artifacts. The Sauvola filter supports a
contrast parameter that can be set in the TOptimizeParams structure. The default value is 0.34 but
lower values down to 0.001 are often useful, especially if the document contains bright text that
would be filtered out by the Otsu filter. Note that the value 0.0 will be treated as not set. That means
the default value 0.34 would be used instead.
Image scaling
If the flag ofScaleImages is set, the function scales imported images according to the settings in the
TOptimizeParams structure. The function distuingishes between 1 bit, gray, and color images. The
minimum resolution of the original image that must be reached before scaling is applied can be set
for these three image types independently.
The minimum resolution of 1 bit images should be around 50% higher than the destination
resolution because scaling of 1 bit images can cause significant loss of quality if the original
resolution is near the destination resolution.
 

Previous topic: Color conversion rules, Overprinting, Recommended compression filters

Next topic: Spot color spaces, Image size check, Masked images (color key masking), Hairline correction, Possible issues, Special flags