Copies the metadata (tags, comments, and markers) to the given image.
Syntax
Parameters
- image
- Destination image
- flags
- Type of metadata to copy
Example
Visual Basic | Copy Code |
---|
Public Sub CopyMetadataToExample()
RasterCodecs.Startup()
Dim codecs As RasterCodecs = New RasterCodecs()
Dim image1 As RasterImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "OCR1.TIF")
Dim image2 As RasterImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "OCR2.TIF")
MessageBox.Show(String.Format("Tags in image1: {0}, tags in image2: {1}", image1.Tags.Count, image2.Tags.Count))
Dim tag As RasterTagMetadata = New RasterTagMetadata(RasterTagMetadata.Copyright, RasterTagMetadataDataType.Byte, New Byte() {1, 2, 3})
image1.Tags.Add(tag)
tag = New RasterTagMetadata(RasterTagMetadata.ExifGps, RasterTagMetadataDataType.Byte, New Byte() {4, 5, 6})
image1.Tags.Add(tag)
MessageBox.Show(String.Format("Tags in image1: {0}, tags in image2: {1}", image1.Tags.Count, image2.Tags.Count))
image1.CopyMetadataTo(image2, RasterMetadataFlags.Tags)
MessageBox.Show(String.Format("Tags in image1: {0}, tags in image2: {1}", image1.Tags.Count, image2.Tags.Count))
image1.Dispose()
image2.Dispose()
codecs.Dispose()
RasterCodecs.Shutdown()
End Sub |
C# | Copy Code |
---|
public void CopyMetadataToExample() { RasterCodecs.Startup(); RasterCodecs codecs = new RasterCodecs(); // load 2 TIF images RasterImage image1 = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "OCR1.TIF"); RasterImage image2 = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "OCR2.TIF"); // show the number of tags in each image MessageBox.Show(string.Format("Tags in image1: {0}, tags in image2: {1}", image1.Tags.Count, image2.Tags.Count)); // add a few tags to the first image RasterTagMetadata tag = new RasterTagMetadata(RasterTagMetadata.Copyright, RasterTagMetadataDataType.Byte, new byte[] { 1, 2, 3 }); image1.Tags.Add(tag); tag = new RasterTagMetadata(RasterTagMetadata.ExifGps, RasterTagMetadataDataType.Byte, new byte[] { 4, 5, 6 }); image1.Tags.Add(tag); // show the number of tags in each image MessageBox.Show(string.Format("Tags in image1: {0}, tags in image2: {1}", image1.Tags.Count, image2.Tags.Count)); // copy the tags from first image to the second image1.CopyMetadataTo(image2, RasterMetadataFlags.Tags); // show the number of tags in each image MessageBox.Show(string.Format("Tags in image1: {0}, tags in image2: {1}", image1.Tags.Count, image2.Tags.Count)); image1.Dispose(); image2.Dispose(); codecs.Dispose(); RasterCodecs.Shutdown(); } |
Remarks
Requirements
Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family
See Also