Implementing Extended FlashPix Support

The FlashPix file format was developed through the combined efforts of Eastman Kodak Company, Microsoft Corporation, Hewlett-Packard Company and Live Picture, Inc. It combines the best features of existing image formats with the benefits associated with object orientation to make using digital color images easier.

The format of a FlashPix file is based on compound object storage, which allows storage of various kinds of data. A FlashPix file may consist of several "pages" where each "page" has storage for a source image, non-image data in the form of comments, transform data, and a stamp or thumbnail. Each image is stored as an entire multi-resolution hierarchy where each resolution in the hierarchy differs from the next highest resolution by a factor of 2 in the x dimension and in the y dimension. LEADTOOLS treats the non-image data stored in FlashPix files as comments. Comments are used to store information pertaining to the image, not actual pixel data. This information may include image title, image subject, camera manufacturer, scan software version number, and so forth. In addition to the image itself, FlashPix files store transform information, such as rotation, shearing, and color manipulation, among others. This data indicates transformations which may be performed on the source image. By storing the transforms, the source image stays in its original state and is transformed, using the stored transforms, at your discretion, only when the file is loaded. A stamp, or thumbnail, provides a small bitmap representation of a FlashPix image. By default, LEADTOOLS saves a stamp of size 96 x 96. This is the largest stamp allowed, even if the user sets larger dimensions.

FlashPix support extends the input/output functionality in LEADTOOLS by providing increased versatility in the handling of color and grayscale images by taking advantage of the complete FlashPix file structure. FlashPix is a newly emerging file format sponsored by Kodak, Microsoft, Hewlett-Packard, and many other industry leaders. LEAD has been asked by this industry group to add the format to LEADTOOLS, and to join the group in supporting this new image format technology. Features include working with non-image data, loading and saving a portion of an image, working with thumbnail images in a FlashPix file, and working with transformation parameters in an existing FlashPix file. These are discussed in more detail below.

For more information about required files, refer to Files To Be Included With Your Application. Further details about the extended FlashPix features are given below:

Working with non-image data

LEADTOOLS treats non-image data as comments. These comments store a variety of information concerning an image. You set comments in a FlashPix file one at a time, using LFileSettings::SetComment. Once all comments are set, the comments are saved using any function which saves files, such as LFile::SaveFile or LFile::Save when creating a new file, or LFile::WriteComment when changing a comment in an existing file. LFileSettings::SetComment, by itself, does not write a comment to a file, it prepares the values for the next save.

Comments are read directly from the file, without having to load the image. With LEADTOOLS FlashPix support you have the ability to read a group of comments such as the "Summary Information Group" (CMNT_FPXSUMMARYINFORMATION), multiple groups of comments such as the "File Source Group" and the "Film Description Group" (CMNT_FPXFILESOURCEGROUP | CMNT_FPXFILMDESCRIPTIONGROUP), or all comments (CMNT_ALL). More information concerning comments and groups of comments may be found in FlashPix File Comments.

Retrieving one or more groups of comments is achieved through the use of LFile::GetCommentSize and LFile::ReadCommentExt, which retrieve the size, in bytes, of the desired comments, and read the comments, respectively. An example of this can be seen under "Example" in the LFile::ReadComment entry. This allows you to retrieve a large number of comments with one function call instead of having to make a separate function call for each comment.

It is also possible to retrieve individual comments such as the image title (CMNT_FPXTITLE), but this must be done using the LFile::ReadComment function.

It is important to note that 1) comments must be set individually and saved when creating a new file, but can be changed in an existing file using LFile::WriteComment in this package, as outlined above and 2) the LFile::GetCommentSize only works for FlashPix files in this version.

Loading and saving a portion of a FlashPix file

Loading and processing large images can be very time consuming. Occasionally you may only need to work with a portion of an image. Using LFile::LoadTile you may load only a portion of a FlashPix image by designating the starting position, width and height of the desired region. This allows you to load only part of an image, without having to load the entire image. Once you are finished with the image tile, you may save that tile using LFile::SaveTile.

Working with thumbnail images in a FlashPix file

A thumbnail, or stamp, is a small bitmap representation of a FlashPix image. Reading a thumbnail image stored in a FlashPix file and loading it into a bitmap may be performed using LFile::ReadStamp. To save a stamp into an already existing FlashPix file, use LFile::WriteStamp. The stamp will be written to the page designated in the SAVEFILEOPTION structure. If that page already has a stamp, it will be overwritten; if the page does not exist, the stamp will be written to the last page present in the file. If the file to which the stamp is being written does not exist, an error will be returned.

Working with transformation parameters in an existing FlashPix file

Images may be transformed by rotation, linear translation, shearing, contrast stretching, sharpening, and blurring, among others. In FlashPix files these transforms may be stored with the image itself. This allows the source image to be unchanged, and the transforms to describe the proposed change. By storing both the transforms and the original image, you can elect to load the image either in its original state or in its transformed state. To help you decide how to load the image, LFile::ReadFileTransforms reads the transforms stored in the image so that you may find out what transform(s) are present. There are four options for loading the image: unchanged, color transforms only, view transforms only and all transforms. If you elect to load the image unchanged, you must make sure both the ELO_IGNOREVIEWTRANSFORMS and the ELO_IGNORECOLORTRANSFORMS flags have been set in the Flags data member of LOADFILEOPTION structure before loading the file. (Note: By setting these flags you are telling the system to ignore the transforms.) To load the image with only the effects of the color transforms incorporated, you must set the ELO_IGNOREVIEWTRANSFORMS flag, and clear the ELO_IGNORECOLORTRANSFORMS flag. To load the image with only the effects of the viewing transforms incorporated, you must set the ELO_IGNORECOLORTRANSFORMS flag and clear the ELO_IGNOREVIEWTRANSFORMS flag. Finally, to load the image with both the color transforms and the view transforms incorporated, clear both the ELO_IGNOREVIEWTRANSFORMS and the ELO_IGNORECOLORTRANSFORMS flags.

To store transforms in a FlashPix file, set the appropriate variables in an instance of FILETRANSFORMS to the desired values and use LFile::WriteFileTransforms to write them to the FlashPix file. For an example using both LFile::ReadFileTransforms and LFile::WriteFileTransforms, see "Example" under the LFile::ReadFileTransforms entry. Further information concerning transforms may be found in FILETRANSFORMS.

See Also

Implementing PhotoCD and FlashPix Features

FlashPix Transforms Options

FlashPix Comments

FlashPix Enumerated Types

FlashPix Structures

Kodak Formats (PCD and FPX)

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.