DynaPDF Manual - Page 544

Previous Page 543   Index   Next Page 545

Function Reference
Page 544 of 839
Bitmap images
Bitmaps support alpha transparency but most image viewers discard the alpha channel. This can
lead to diffent results since DynaPDF considers the alpha channel in 32 bit bitmaps by default.
Since many 32 bit bitmaps contain an invalid alpha channel that is zero for all pixels, it is possible to
fully discard the alpha channel as most image viewers would do. This can be achieved by setting the
flag gfNoBitmapAlpha with SetGStateFlags().
GIF images
GIF images are LZW compressed images which are widely used in the internet. LZW is a loss-less
compression filter. Non-transparent GIF images are recompressed with the current compression
filter when inserting the image. The optimal compression filter for GIF images is Flate, and
therefore, the compression filter should be set to Flate before inserting such an image (see
SetCompressionFilter()).
Transparent GIF images are handled differently. GIF images use color key masking to achieve the
transparency effect. This kind of masking depends on exact color values and therefore, it is not
possible to compress such images with JPEG or JPEG 2000 compression without invalidating the
transparency information. To achieve correct results DynaPDF changes the compression filter for
transparent GIF images automatically to Flate and the image will not be downscaled independent of
the used settings.
Note also that transparent GIF images will be inserted transparent independent of the current
transparency settings. DynaPDF considers also the image resolution information if the image uses
different values for the x- and y-axis.
How to calculate the image size?
The calculation of the image size should be easy as possible. In most cases, images must be inserted
with exact proportions. Therefore, all image functions support two special values to make the
calculation easier. The width and height can be calculated as follows:
If ScaleWidth or ScaleHeight is -1 the function uses the original width or height from the
image. If both parameters are -1 the image will be inserted with a resolution of 72 DPI.
If ScaleWidth or ScaleHeight is 0, the missing value is calculated in relation to the given value
of ScaleHeight or ScaleWidth to preserve the image's aspect ratio. The resulting output is an
image with exact proportions relative to its original size.
If ScaleWidth and ScaleHeight is 0, the original size is used (same effect as -1).
A negative value of Width or Height mirrors the image on the x- and or y-axis.
Image Resolution
Images will be scaled to the defined resolution (see SetResolution()) if the original size is larger than
required, and if the property SaveNewImageFormat is set to true (default).
 

Previous topic: 1 Bit TIFF images

Next topic: Transparent images (Color Key Masking), Images with an alpha channel