←Select platform

SaveXMPMetadata(string,string) Method

Summary
Saves all XMP metadata from the source XML file to the destination image file.
Syntax
C#
VB
C++
public void SaveXMPMetadata( 
   string sourceFileName, 
   string destFileName 
) 
Public Overloads Sub SaveXMPMetadata( _ 
   ByVal sourceFileName As String, _ 
   ByVal destFileName As String _ 
)  
public: 
void SaveXMPMetadata(  
   String^ sourceFileName, 
   String^ destFileName 
)  

Parameters

sourceFileName
A String containing the source XML file from which the metadata should be read.

destFileName
A String containing the destination image filename to which the metadata should be written.

Remarks

The XML file referenced by sourceFileName must contain a valid XMP Data.

The file referenced by destFileName must be a file format that supports XMP. For example PNG, PDF, JPEG, TIFF and SVG.

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 static void SaveXMPMetadataExample() 
{ 
	// 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 Metamata 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) 
		{ 
			Console.WriteLine(ex.Message); 
		} 
	} 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS21\Resources\Images"; 
} 
Requirements

Target Platforms

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

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