// Example of how to remove a single tag/field.
//
// Note that this approach is crude: Exif data is organized in
// directories. The same tag/field may appear in more than one
// directory.
TiffOutputField aperture = outputSet
.findField(TiffConstants.EXIF_TAG_APERTURE_VALUE);
if (null != aperture)
{
// set contains aperture tag/field.
outputSet
.removeField(TiffConstants.EXIF_TAG_APERTURE_VALUE);
}
}
{
// Example of how to add a field/tag to the output set.
//
// Note that you should first remove the field/tag if it already exists
// in this directory. See above.
//
// Certain fields/tags are expected in certain Exif directories;
// Others can occur in more than one directory (and often have a different
// meaning in different directories).
//
// TagInfo constants often contain a description of what directories
// are associated with a given tag.
//
// see org.apache.sanselan.formats.tiff.constants.AllTagConstants
//
TiffOutputField aperture = TiffOutputField.create(
TiffConstants.EXIF_TAG_APERTURE_VALUE,
outputSet.byteOrder, new Double(0.3));
TiffOutputDirectory exifDirectory = outputSet
.getOrCreateExifDirectory();
exifDirectory.add(aperture);