Xojo Conferences

DynaPDF Manual - Page 495

Previous Page 494   Index   Next Page 496

Function Reference
Page 495 of 770
= w / (resY / resX);
physHeight = h;
physHeight = h;
= w;
Note that the above calculation uses integer arithmetic. Note also that you don't need to consider the
physical size when inserting such an image. The physical size should be used to determine the paper
format when converting scanned faxes to PDF since the logical format produces often no exact match
with available paper formats when calculated with the given resolution information.
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
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:

Previous topic: Why does DynaPDF not support LZW compression?, TIFF images, 1 Bit TIFF images

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