Xojo Conferences
MBSOct2019CologneDE

DynaPDF Manual - Page 491

Previous Page 490   Index   Next Page 492

Function Reference
Page 491 of 766
Why does DynaPDF not support LZW compression?
LZW is a very fast lossless compression filter that can be used for sampled images and arbitrary
binary data. Flate encoded output is usually more compact than LZW encoded output for the same
input, but Flate encoding is considerably slower than LZW. However, LZW encoding is marked as
obsolete by Adobe. Because it is not clear whether this filter will be supported in future versions of
Adobe's Acrobat, it will not be added to DynaPDF.
TIFF images
The TIFF image format is the most complex format of all available image formats. DynaPDF
supports a full featured implementation of the TIFF format incl. most currently available
compression methods and color spaces. TIFF images can be organized in scanlines, tiles or stripes, all
three formats are fully supported by DynaPDF.
If the image is a multi-page image, a specific image can be selected with the parameter Index. The
first image has the index 1. The number of available images inside a multi-page image can be
determined with the function GetImageCount().
TIFF images can be defined in device dependent and device independent color spaces, such as Lab,
CalGray, CalRGB, or ICC based color spaces. If the original color space should be preserved if
possible, set the flag gfUseImageColorSpace with SetGStateFlags(). See also Color Spaces and
Images.
1 Bit TIFF images
1 bit TIFF images use sometimes different resolutions for the x- and y-axis. DynaPDF considers the
resolution information and scales the image according to the resolution information that is stored in
the image file. Note that the resolution information is only considered for 1 bit images. No
adjustment will be applied for higher bit depths since most image viewers do the same.
It is important to know that ReadImageFormat() or ReadImageFormat2() return the logical size of 1
bit TIFF images. That means, the resolution information was already taken into account. The physical
size of a 1 bit TIFF image can be calculated as follows:
SI32 bits, useZip;
UI32 resX = 0, resY = 0, physHeight, physWidth, w, h;
pdfReadImageFormat2(pdf, "test.tif", 1, w, h, bits, useZip);
pdfReadImageResolution(pdf, "test.tif", 1, resX, resY);
if (resX != resY && resX > 0 && resY > 0)
{
if (resX > resY)
{
physWidth
= w;
physHeight = h / (resX / resY);
}else
{
 

Previous topic: JPEG 2000 (Experimental)

Next topic: How to calculate the image size?