DynaPDF Manual - Page 543

Previous Page 542   Index   Next Page 544

Function Reference
Page 543 of 839
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
{
physWidth
= w / (resY / resX);
physHeight = h;
}
}else
{
physHeight = h;
physWidth
= 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.
 

Previous topic: Quality comparison against JPEG, Embedded ICC profiles, Pass-through mode, Why does DynaPDF not support LZW compression?, TIFF images

Next topic: Bitmap images, GIF images, How to calculate the image size?, Image Resolution