←Select platform

CopyMetadataTo Method

Summary
Copies the metadata (tags, comments, and markers) to the given image.
Syntax
C#
Objective-C
C++/CLI
Java
Python
public void CopyMetadataTo( 
   RasterImage image, 
   RasterMetadataFlags flags 
) 
- (void)copyMetadataTo:(LTRasterImage *)image  
                 flags:(LTRasterMetadataFlags)flags 
public void copyMetadataTo( 
   RasterImage image, 
   int flags 
); 
public: 
void CopyMetadataTo(  
   RasterImage^ image, 
   RasterMetadataFlags flags 
)  
def CopyMetadataTo(self,image,flags): 

Parameters

image
Destination image

flags
Type of metadata to copy

Remarks

This methods copies the metadata found in the Tags, Comments and/or Markers collections of this RasterImage to  image.

Before the copy operation, this method will clear any metadata already found in  image.

For more information on GeoKeys, refer to Implementing GeoKeys (GeoTIFF tags).

For more information, refer to Non Image Data.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Core; 
using Leadtools.ImageProcessing.Color; 
using Leadtools.Dicom; 
using Leadtools.Drawing; 
using Leadtools.Controls; 
using Leadtools.Svg; 
 
 
public void CopyMetadataToExample() 
{ 
   RasterCodecs codecs = new RasterCodecs(); 
   // load 2 TIF images 
   RasterImage image1 = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "OCR1.TIF")); 
   RasterImage image2 = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "OCR2.TIF")); 
 
   // show the number of tags in each image 
   Console.WriteLine(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 
   Console.WriteLine(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 
   Console.WriteLine(string.Format("Tags in image1: {0}, tags in image2: {1}", image1.Tags.Count, image2.Tags.Count)); 
 
   image1.Dispose(); 
   image2.Dispose(); 
   codecs.Dispose(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 23.0.2024.5.22
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.