This example demonstrates how to insert a custom tag into an EXIF package.
C#
using (Metadata metadata = new Metadata("input.tiff"))
{
IExif root = metadata.GetRootPackage() as IExif;
if (root != null)
{
// Assign the EXIF package if it is missing.
if (root.ExifPackage == null)
{
root.ExifPackage = new ExifPackage();
}
// Insert a recognized property.
root.ExifPackage.Set(new TiffAsciiTag(TiffTagID.Artist, "test artist"));
// Include a fully custom property that is not part of the EXIF specification.
// Be aware that the chosen ID may conflict with IDs used by some third-party tools.
root.ExifPackage.Set(new TiffAsciiTag((TiffTagID)65523, "custom"));
metadata.Save("output.tiff");
}
}