GroupDocs.Metadata for .NET 18.9 Release Notes

Major Features

There are the following enhancements in this release:

  • Remove EpubFormat.GetImageCoverBytes method (obsolete code)
  • Remove GroupDocs.Metadata.Formats.Document.InspectionResult class (obsolete code)
  • Remove XlsMetadata.ContentProperties property (obsolete code)
  • Implement the ability to read and update common TIFF/EXIF tags in TIFF images
  • Reduce memory consumption of the GIF format

All Changes

KeySummaryCategory
METADATANET-2320Remove EpubFormat.GetImageCoverBytes method (obsolete code)Enhancement
METADATANET-2321Remove GroupDocs.Metadata.Formats.Document.InspectionResult class (obsolete code)Enhancement
METADATANET-2322Remove XlsMetadata.ContentProperties property (obsolete code)Enhancement
METADATANET-2446Implement the ability to read and update common TIFF/EXIF tags in TIFF imagesEnhancement
METADATANET-2449Reduce memory consumption of the GIF formatEnhancement
METADATANET-2417Unable to add TiffTag to EXIF tagsBug
METADATANET-2418Unable to remove Title, Subject, Authors, and Copyright fields in Tiff fileBug
METADATANET-2420TIF file SetSubject() method updates Tags field instead of SubjectBug

Public API and Backward Incompatible Changes

Remove EpubFormat.GetImageCoverBytes method (obsolete code)

Description

This enhancement removes the EpubFormat.GetImageCoverBytes method from the public API (obsolete code). Please use the EpubFormat.ReadThumbnail method instead*.*

Public API changes

The GetImageCoverBytes method has been removed from the *EpubFormat *class

Usecases

Get the image cover data and MIME type

using (EpubFormat epubFormat = new EpubFormat(@"D:\input.epub"))
{
    ThumbnailMetadata thumbnail = epubFormat.ReadThumbnail();
    if (thumbnail != null)
    {
        Console.WriteLine(thumbnail.ImageData.Length);
        Console.WriteLine(thumbnail.MimeType);
    }
}

Remove GroupDocs.Metadata.Formats.Document.InspectionResult class (obsolete code)

Description

This enhancement removes the GroupDocs.Metadata.Formats.Document.InspectionResult class from the public API (obsolete code). Please use an appropriate implementation of the IInspectorResult interface instead*.*

Public API changes

The InspectionResult class has been removed from the GroupDocs.Metadata.Formats.Document namespace

Usecases

Inspect a document.

using (DocFormat format = new DocFormat(@"D:\input.docx"))
{
    DocInspectionResult inspectionResult = format.InspectDocument();
    Console.WriteLine(inspectionResult.DigitalSignatures.Length);
    Console.WriteLine(inspectionResult.Comments.Length);
}

Remove XlsMetadata.ContentProperties property (obsolete code)

Description

This enhancement removes the XlsMetadata.ContentProperties property from the public API (obsolete code). Please use the XlsMetadata*.ContentTypeProperties* property instead*.*

Public API changes

The ContentProperties property has been removed from the XlsMetadataclass

Usecases

Get the content type properties.

using (XlsFormat format = new XlsFormat(@"D:\input.xlsx"))
{
    foreach (XlsContentProperty property in format.DocumentProperties.ContentTypeProperties)
    {
        Console.WriteLine(property.GetFormattedValue());
    }
}

Implement the ability to read and update common TIFF/EXIF tags in TIFF images 

Description

This enhancement allows a user to read and update some common TIFF/EXIF metadata tags in TIFF images.

Public API changes

The SubfileType item has been added to the TiffTagIdEnum enum
The T4Options item has been added to the TiffTagIdEnum enum
The T6Options item has been added to the TiffTagIdEnum enum
The TransferFunction item has been added to the TiffTagIdEnum enum
The WhitePoint item has been added to the TiffTagIdEnum enum
The PrimaryChromaticities item has been added to the TiffTagIdEnum enum
The HalftoneHints item has been added to the TiffTagIdEnum enum
The InkNames item has been added to the TiffTagIdEnum enum
The DotRange item has been added to the TiffTagIdEnum enum
The SampleFormat item has been added to the TiffTagIdEnum enum
The SMinSampleValue item has been added to the TiffTagIdEnum enum
The SMaxSampleValue item has been added to the TiffTagIdEnum enum
The TransferRange item has been added to the TiffTagIdEnum enum
The JPEGProc item has been added to the TiffTagIdEnum enum
The JPEGInterchangeFormat item has been added to the TiffTagIdEnum enum
The JPEGInterchangeFormatLength item has been added to the TiffTagIdEnum enum
The JPEGRestartInterval item has been added to the TiffTagIdEnum enum
The JPEGLosslessPredictors item has been added to the TiffTagIdEnum enum
The JPEGPointTransforms item has been added to the TiffTagIdEnum enum
The JPEGQTables item has been added to the TiffTagIdEnum enum
The JPEGDCTables item has been added to the TiffTagIdEnum enum
The JPEGACTables item has been added to the TiffTagIdEnum enum
The YCbCrCoefficients item has been added to the TiffTagIdEnum enum
The YCbCrSubSampling item has been added to the TiffTagIdEnum enum
The YCbCrPositioning item has been added to the TiffTagIdEnum enum
The ReferenceBlackWhite item has been added to the TiffTagIdEnum enum
The UserComment item has been added to the TiffTagIdEnum enum
The ExifIfdInfo class has been added to the GroupDocs.Metadata.Formats.Image namespace
The ExifIfdData property has been added to the ExifInfo class
The Artist property has been added to the ExifInfo class
The Copyright property has been added to the ExifInfo class
The DateTime property has been added to the ExifInfo class
The ImageDescription property has been added to the ExifInfo class
The ImageLength property has been added to the ExifInfo class
The ImageWidth property has been added to the ExifInfo class
The Make property has been added to the ExifInfo class
The Model property has been added to the ExifInfo class
The Software property has been added to the ExifInfo class
The JpegExifInfo class has been marked as obsolete
The ExifInfo.BodySerialNumber property has been marked as obsolete
The ExifInfo.CFAPattern property has been marked as obsolete
The ExifInfo.CameraOwnerName property has been marked as obsolete
The ExifInfo.UserComment property has been marked as obsolete

Usecases

Update common EXIF/TIFF metadata tags by using the shortcut properties.

using (TiffFormat format = new TiffFormat(@"D:\input.tif"))
{
    format.ExifValues.Artist = "GroupDocs";
    format.ExifValues.Software = "GroupDocs.Metadata";
 
    format.Save(@"D:\output.tif");
}

Update common EXIF/TIFF metadata tags by replacing the whole tag collection.

using (TiffFormat format = new TiffFormat(@"D:\input.tif"))
{
    TiffTag[] tags = new TiffTag[]
    {
        new TiffAsciiTag(TiffTagIdEnum.Artist, "GroupDocs"),
        new TiffAsciiTag(TiffTagIdEnum.Copyright, "GroupDocs.Metadata"),
    };
    format.ExifValues.Tags = tags;
 
    format.Save(@"D:\output.tif");
}

Update EXIF IFD tags by using the shortcut properties.

using (TiffFormat format = new TiffFormat(@"D:\input.tif"))
{
    format.ExifValues.ExifIfdData.UserComment = "test comment";
    format.ExifValues.ExifIfdData.BodySerialNumber = "1010101010";
    format.Save(@"D:\output.tif");
}

Update EXIF IFD tags by replacing the whole tag collection.

using (TiffFormat format = new TiffFormat(@"D:\input.tif"))
{
    TiffTag[] tags = new TiffTag[]
    {
            new TiffAsciiTag((TiffTagIdEnum)42032, "test camera owner"), // CameraOwnerName
            new TiffAsciiTag((TiffTagIdEnum)42033, "test body serial number"), // BodySerialNumber
    };
    format.ExifValues.ExifIfdData.Tags = tags;
    format.Save(@"D:\output.tif");
}

Reduce memory consumption of the GIF format

Description

This enhancement allows working with gif images with less memory consumption.

Public API changes

None.

Usecases

Please note that the GifFormat class implements the IDisposable interface and it’s necessary to call the Dispose() method when you’re done working with its instance.

using (GifFormat format = new GifFormat(@"d:\input.gif"))
{
    // Working with metadata
}

If you are loading a gif file from a stream, it’s up to you to close the stream when the file is not needed anymore.

using (Stream stream = File.Open(@"d:\input.gif", FileMode.Open, FileAccess.ReadWrite))
{
    using (GifFormat format = new GifFormat(stream))
    {
        // Working with metadata
    }
    // The stream is still open here
}

The same rule works if you are saving the output file into a stream.

using (Stream stream = File.Open(@"d:\output.gif", FileMode.OpenOrCreate, FileAccess.ReadWrite))
{
    using (GifFormat format = new GifFormat(@"d:\input.gif"))
    {
        // Working with metadata
 
        format.Save(stream);
    }
    // The stream is still open here
}

Unable to add TiffTag to EXIF tags

Description

When adding TiffTag to EXIF tags in a .tif file. The API saves the file without any exception, however, it doesn’t add the tags. If we get TIFF tags using ExifInfo.Tags property from the saved file, the API returns no tags.

Public API changes

None.

Usecases
using (TiffFormat tiffFormat = new TiffFormat(@"D:\input.tif"))
{
    // get existing EXIF or create new one
    ExifInfo exif = tiffFormat.GetExifInfo() ?? new ExifInfo();
 
    // define list of tags
    List<TiffTag> tags = new List<TiffTag>();
 
    // add specific tag
    tags.Add(new TiffAsciiTag(TiffTagIdEnum.Artist, "Rida"));
    tags.Add(new TiffAsciiTag(TiffTagIdEnum.Copyright, "copyright"));
 
    // and update tags
    exif.Tags = tags.ToArray();
 
    // update exif
    tiffFormat.UpdateExifInfo(exif);
 
    tiffFormat.Save(@"D:\output.tif");
}
Description

Unable to remove Title, Subject, Authors, and Copyright fields in a TIFF file.

Public API changes

None.

Usecases
using (TiffFormat tiffFormat = new TiffFormat(@"D:\input.tif"))
{
    tiffFormat.CleanMetadata();
    tiffFormat.Save(@"D:\output.tif");
}

TIFF file SetSubject() method updates Tags field instead of Subject

Description

While updating the subject field of the TIFF file, Tags field gets updated.

Public API changes

The Subjects property has been added to the DublinCorePackage class
The DublinCorePackage.Subject property has been marked as obsolete
The DublinCorePackage.SetSubject(string[]) method has been marked as obsolete

Usecases

Set a single subject.

using (TiffFormat format = new TiffFormat(@"D:\input.tif"))
{
    format.XmpValues.Schemes.DublinCore.SetSubject("test subject");
    format.Save(@"D:\output.tif");
}

Set multiple subjects.

using (TiffFormat format = new TiffFormat(@"D:\input.tif"))
{
    format.XmpValues.Schemes.DublinCore.Subjects = new[] { "subject 1", "subject 2" };
    format.Save(@"D:\output.tif");
}