←Select platform

WriteMarker(string,int,RasterMarkerMetadata) Method

Summary
Writes a marker to an existing file.
Syntax
C#
VB
Objective-C
C++
public void WriteMarker( 
   string fileName, 
   int pageNumber, 
   RasterMarkerMetadata marker 
) 
Public Overloads Sub WriteMarker( _ 
   ByVal fileName As String, _ 
   ByVal pageNumber As Integer, _ 
   ByVal marker As RasterMarkerMetadata _ 
)  
- (BOOL)writeMarker:(nullable LTRasterMarkerMetadata *)marker  
             toFile:(NSString *)file  
         pageNumber:(NSInteger)pageNumber  
              error:(NSError **)error 
public: 
void WriteMarker(  
   String^ fileName, 
   int pageNumber, 
   RasterMarkerMetadata^ marker 
)  

Parameters

fileName
A String that contains the file name.

pageNumber
1-based index of the page at which to write the marker.

marker
A RasterMarkerMetadata object that contains the marker data.

Remarks

For Exif files, this metadata collection will contain all the Exif and GPS comments, stored in APP1. It will also contain the audio information stored in APP2.

When you add or remove tags, the tags array at the end of the file is re-written. When you modify existing tags, the new tag value is added to the file and the IFD is modified as necessary. In all of these cases, there is no image recompression.

Example

This example read the markers from a source file and saving them to a destination file

C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Color; 
using Leadtools.Svg; 
 
 
void MarkersExample(string srcFileName, string destFileName) 
{ 
	RasterCodecs codecs = new RasterCodecs(); 
 
	// Load the source image with markers 
	Console.WriteLine("Loading the source image with all markers"); 
	codecs.Options.Load.Markers = true; 
	RasterImage srcImage = codecs.Load(srcFileName); 
 
	// Show the markers loaded 
	Console.WriteLine("These markers were loaded:"); 
	foreach (RasterMarkerMetadata marker in srcImage.Markers) 
	{ 
		byte[] data = marker.GetData(); 
		Console.WriteLine(" {0}, DataSize:{1}", marker.Id, data.Length); 
	} 
 
	// Create the destination image 
	RasterImage destImage = new RasterImage( 
	   RasterMemoryFlags.Conventional, 
	   320, 
	   20, 
	   24, 
	   RasterByteOrder.Bgr, 
	   RasterViewPerspective.TopLeft, 
	   null, 
	   IntPtr.Zero, 
	   0); 
 
	// Save this as JPEG 
	codecs.Save(destImage, destFileName, RasterImageFormat.Jpeg, 24); 
 
	// Write the markers from the source image to this destination image 
	Console.WriteLine("Writing the markers to the destination file"); 
	codecs.WriteMarkers(destFileName, 1, srcImage.Markers); 
 
	srcImage.Dispose(); 
	destImage.Dispose(); 
 
	// Re-load the destination image with markers 
	Console.WriteLine("Loading the destination image with all markers"); 
	codecs.Options.Load.Markers = true; 
	destImage = codecs.Load(destFileName); 
 
	// Show the markers loaded 
	Console.WriteLine("These markers were loaded:"); 
	foreach (RasterMarkerMetadata marker in destImage.Markers) 
	{ 
		byte[] data = marker.GetData(); 
		Console.WriteLine(" {0}, DataSize:{1}", marker.Id, data.Length); 
	} 
 
	destImage.Dispose(); 
 
	// Clean up 
	codecs.Dispose(); 
} 
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.