←Select platform

ExtractXMPMetadata(Stream,Stream) Method

Summary
Extracts all XMP metadata from the source file and saves it to the destination XML file.
Syntax
C#
C++/CLI
Java
Python
public void ExtractXMPMetadata( 
   Stream sourceStream, 
   Stream destStream 
) 
public void extractXMPMetadata(ILeadStream sourceStream, ILeadStream destStream) 
public: 
void ExtractXMPMetadata(  
   Stream^ sourceStream, 
   Stream^ destStream 
)  
def ExtractXMPMetadata(self,sourceStream,destStream): 

Parameters

sourceStream
A Stream containing the source image file from which the metadata should be read.

destStream
A destination Stream to which the metadata should be written in XML format.

Remarks

The Stream referenced by sourceStream must be a file format that supports XMP. For example JPEG, TIFF and WebP.

To determine if a file format supports XMP, use MetadataItemsSupported.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Color; 
using Leadtools.Svg; 
 
 
public void ExtractXMPMetadataExample() 
{ 
   // The source file 
   string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "Leadtools.pdf"); 
   string xmlFileName = Path.Combine(LEAD_VARS.ImagesDir, "XMP.xml"); 
   string dstFileName = Path.Combine(LEAD_VARS.ImagesDir, "cannon.jpg"); 
 
   using (var codecs = new RasterCodecs()) 
   { 
      try 
      { 
         //Extract XMP Metadata & save it to a XML file. 
         codecs.ExtractXMPMetadata(srcFileName, xmlFileName); 
 
         /* 
         Add/Update Metadata in the XML file using any XML parser(if needed). 
         */ 
 
         //Save XMP Metadata to a destination file using XML file that contains XMP Metadata. 
         codecs.SaveXMPMetadata(xmlFileName, dstFileName); 
      } 
      catch (RasterException ex) 
      { 
         Debug.WriteLine(ex.Message); 
      } 
   } 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
Requirements

Target Platforms

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

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