ImageGear Professional for Linux
Saving a TIFF File Using Tiles

When you save a TIFF image to disk, you can tell ImageGear to save the bitmap data as tiles, regardless of what storage scheme was originally used. To choose tiled storage and to make modifications to the way ImageGear will implement these storage schemes, use the IG_fltr_ctrl_set() and IG_fltr_ctrl_get() functions. For more information on getting/setting filter control parameters see Using Format Filters API for Filter Control.

The following TIFF filter control parameters are related to tiles:

Please see the section TIFF in the File Format Reference for detailed information about the parameters.

The following example call shows an example image loaded into memory with only tiles 5, 6, 8, and 9, and then being saved as a tiled image with 20 tiles:

 
Copy Code
/* Declare a structure of type AT_STITCH */
AT_STITCH stitchStruct;
UINT nPage;
HIGEAR hIGear;
LONG lHorizTileCount, lVertTileCount;
/* Set uRefTile to the number of the tile that you would like to use as the upper-
left most tile in the stitched image */
stitchStruct.uRefTile = 5;
/* Set uTileRows to the number of tiles that you would like per row */
stitchStruct.uTileRows = 2;
/* Set uTileCols to the number of tiles that you would like per column */
stitchStruct.uTileCols = 2;
/* Set lHorizontalTileCount to the number of tiles per row that ImageGear should
make when an image is saved to disk as a tiled TIFF. */
lHorizTileCount = 5;
/* Set lVertTileCount to the number of rows that ImageGear should make when an image
is saved to disk as a tiled TIFF. */
lVertTileCount = 4;
/* Set nPage to the page number of a multi-page TIFF that you would like to load. If
the TIFF isn't multi-page, set to 1. */
nPage = 1;
/* This function loads the tiles specified by &stitchStruct, stitches them together
in a DIB and returns you a HIGEAR to the image in &lphIGear.*/
IG_load_tiles_stitch("KidsKatz.tif", nPage, &stitchStruct, &hIGear);
/* Use the Filter Control function to tell ImageGear how to configure TIFF files
when it saves them to disk. This call specifies that they should be saved as tiled
images and that you will be providing ImageGear will a fixed number of tiles to
create when saving the file. */
IG_fltr_ctrl_set(IG_FORMAT_TIF, "WRITE_CONFIG", (LPVOID)IG_TIF_TILED_FIXED_COUNT,
sizeof(lpWriteConfig));
/* Use the Filter Control function to tell ImageGear how many tiles per row you would
like to make in images saved to disk as TIFFs. */
IG_fltr_ctrl_set(IG_FORMAT_TIF, "TILE_H_COUNT", (LPVOID)lHorizTileCount,
sizeof(lHorizTileCount));
/* Use the Filter Control function to tell ImageGear how many rows of tiles you would
like to make in images saved to disk as TIFFs. */
IG_fltr_ctrl_set(IG_FORMAT_TIF, "TILE_V_COUNT", (LPVOID)lVertTileCount,
sizeof(lVertTileCount));
/* Call IG_fltr_save_file() to save the current HIGEAR image as an uncompressed
TIFF. */
IG_fltr_save_file(hIGear, "KidsKatz.tif", IG_SAVE_TIF_UNCOMP, 1, TRUE);
If you do not specify the configuration to use for saving a TIFF image to disk, ImageGear will use the default setting of IG_TIF_STRIP_FIXED_COUNT. If you do not specify a number of strips, the default of 1 is used.

TIFF Storage

The TIFF format filter supports four modes of storage for writing out to a TIFF file. All settings are made by supplying "WRITE_CONFIG" control parameter for the function IG_fltr_ctrl_set(). Here are the possible settings:

IG_TIF_STRIP_FIXED_COUNT Write the image using a fixed number of strips. The number of strips to use can be set via the NUMBER_OF_STRIPS control parameter.
IG_TIF_STRIP_FIXED_BUFFER Write the image using strips so that each strip is not greater than the specified size in bytes. The size of the strip buffer can be set via the BUFFER_SIZE control parameter. Please note that at least one raster will be included in the strip.
IG_TIF_TILED_FIXED_SIZE Save the image using tiles of fixed size. The size of the tiles can be set via the TILE_WIDTH and TILE_HEIGHT control parameters.
IG_TIF_TILED_FIXED_COUNT Save the image using a fixed number of tiles. The number of tiles in both the horizontal and vertical direction can be set via the control parameters TILE_H_COUNT and TILE_V_COUNT.

 

 


©2016. Accusoft Corporation. All Rights Reserved.

Send Feedback