Xojo Conferences

DynaPDF Manual - Page 532

Previous Page 531   Index   Next Page 533

Function Reference
Page 532 of 766
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 as the destination resolution
because scaling of 1 bit images can cause significant loss of quality if the original resolution is near
the destination resolution.
The minimum resolution of gray and color images can be freely chosen. 1 means scale all images.
The function scales images only if the minimum resolution is greater zero.
Images wich use a special color space like Separation, DeviceN, NChannel, or Lab cannot be scaled.
Such images are left unchanged.
The function checks whether the new image is smaller as the original one. If no size reduction can be
achieved then the image is stored as is.
The size check can be disabled with the flag ofNoImageSizeCheck.
Images which were inserted with DynaPDF functions like InsertImage() will be ignored.
Masked images (color key masking)
Color key masking is a technique to make parts of an image transparent. This type of masking
depends on exact color values because a specific color is used to mask the transparent areas. If such
an image will be scaled, it is possible that the color of certain pixels will be changed due to color
interpolation and this can lead to visible differences which are maybe not acceptable.
To avoid issues with masked images it is recommended to set the flag ofSkipMaskedImages.
Hairline correction
If the member MinLineWidth of the structure TOptimizeParams is greater zero the line width of
stroked paths will be set to MinLineWidth if the scaled value was smaller. The function considers all
transformations of the coordinate system.
The line width is measured in PDF units. One PDF unit represents 1/72 inch.
The minimum line width should be smaller or equal 1.0. The maximum value is 10.0 units.
Depending on the used flags it is possible to correct real hairlines only (zero width lines), all lines
which are thinner than MinLineWidth, or all lines with exception of real hairlines (line width = 0).
Possible issues
Hairline correction does not always produce the expected result, e.g. lines which look like a stroked
path are in fact filled rectangles. It is also possible that a surrounding clipping path prevents a visible
change of the line width.

Previous topic: Converting gray images to 1 bit (black & white)

Next topic: Error handling