Exporting Images

Image Export Functions

PixelLive SDK provides the following image export functions by default:

Each function described above is in the same format and for all you have to do with them is passing a Storage instance and an Image instance. The code below illustrates it:

AutoPtr<DiskStorageWithRollback> storage = DiskStorageWithRollback::create("test.tif");
exportAsTIFF(storage, image); // assume that image points to an Image instance.
storage->commit();
For the whole steps of exporting an image instance, see Simple Tutorials.
See also:
Simple Tutorials, DiskStorageWithRollback

Modifying Metadata for Exporting Images

Although it is straight-forward to export an Image instance as some format (just explained above), we seem to have no opportunity of modifying metadata of the Image instance in the sample code. But it is not true. We have opportunity to modify the metadata. See the illustration below; the way we've adopted in the samples is on the left. On the right, we can see another that allows us to modify the metadata just before calling exportAsXXX function. To adopt the way, we should use the third parameter of exportAsXXX function. If the parameter is not specified (or NULL), exportAsXXX function uses the metadata obtained from the Image instance, otherwise exportAsXXX function uses the metadata specified by it instead of the metadata obtained from the Image instance. For information about Metadata handling, see Metadata Handling.

mod_metadata.png

The code below illustrate how to modify the metadata before calling exportAsXXX function:

AutoPtr<DataStore> metadata = image->getMetadata();

// We can modify the metadata!
TIFF6::set(metadata, "Artist", "Leonardo da Vinci");
TIFF6::set(metadata, "Software", "My mighty image program");

AutoPtr<DiskStorageWithRollback> storage = DiskStorageWithRollback::create("test.bmp", accessWrite);
exportAsVFZ(storage, image, metadata);
storage->commit();

Exporting PFZ Files

PFZ Files requires more information than the other exportAsXXX functions. The following code illustrates how to deal with this function:
AutoPtr<HttpManager> httpMan = HttpManager::create("My Export Test/1.0");
String padsAddr = "pads.somewhere.org:12222";
AutoPtr<CredentialProvider> credProv = CredentialProvider::createFromStrings("username", "password");

AutoPtr<DiskStorageWithRollback> storage = DiskStorageWithRollback::create("test.pfz", accessWrite);
exportAsPFZ(storage, image, padsAddr, credProv, httpMan);
storage->commit();

See also:
TIFF6, DiskStorageWithRollback, HttpManager, CredentialProvider

Exporting Multipage TIFF Files

To export multipage TIFF files, firstly you have to pack the Image instances corresponding to the pages to SimpleArray and then pass it to exportAsMultiPageTIFF function. If you also want to modify the metadata for each page, you can set them by the third parameter. And if the third parameter has only one entry, it just means all the pages have the same metadata. If no entries in the third parameter, it means no metadata is overwritten. The following code illustrates this:
SimpleArray< AutoPtr<Image> > pages;
SimpleArray< AutoPtr<DataStore> > metadata;

pages.push_back(firstPage);
pages.push_back(secondPage);
pages.push_back(thirdPage);

exportAsMultiPageTIFF(storage, pages, metadata);

See also:
SimpleArray

This document is automatically generated using doxygen 1.5.4 at Fri Jun 27 18:22:54 2008.