When we remove the EXIF metadata of some TIFF files, we cannot use the removed files to initialize the Metadata instance, it will throw an exception: GroupDocs.Metadata.Exceptions.GroupDocsMetadataException: 'Image loading failed.'
The version of GroupDoc we are using is 22.9.0.0.
using (Metadata metadata = new Metadata(fileInput))
{
IExif root = metadata.GetRootPackage() as IExif;
if (root != null && root.ExifPackage != null)
{
root.ExifPackage.Artist = “artist”;
ushort tagId = 40095;
if (root.ExifPackage[(TiffTagID)tagId] != null)
root.ExifPackage.Remove((TiffTagID)tagId);
metadata.Save(fileOutput);
}
}
using (Metadata metadata = new Metadata(fileOutput)) //
{
IExif root = metadata.GetRootPackage() as IExif;
if (root != null && root.ExifPackage != null)
{
Console.WriteLine(root.ExifPackage.Artist);
}
}
Chrysanthemum.7z (1.6 MB)