←Select platform

Id Property

Summary
Gets or sets the marker id.
Syntax
C#
Objective-C
C++/CLI
Java
Python
public int Id { get; set; } 
@property (nonatomic, assign) NSInteger markerId 
public int getId(); 
public void setId( 
   int intValue 
); 
public: 
property int Id { 
   int get(); 
   void set (    int ); 
} 
Id # get and set (RasterMarkerMetadata) 

Property Value

ID of the JPEG marker to write. The JPEG markers are uniquely identified by a byte value.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
 
 
public void RasterMarkerMetadataExample() 
{ 
	RasterCodecs codecs = new RasterCodecs(); 
	codecs.ThrowExceptionsOnInvalidImages = true; 
 
	string srcFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp"); 
	string destFileName = Path.Combine(LEAD_VARS.ImagesDir, "Image1_markers.tif"); 
 
	// Load the image 
	RasterImage image = codecs.Load(srcFileName); 
	codecs.Save(image, destFileName, RasterImageFormat.ExifJpeg, 24); 
 
	image.Dispose(); 
 
	// write a marker to the file 
	RasterMarkerMetadata markerWrite = new RasterMarkerMetadata(); 
	byte[] data = new byte[100]; 
	for (int i = 0; i < data.Length; i++) 
		data[i] = (byte)(i + 1); 
	markerWrite.Id = RasterMarkerMetadata.App2; 
	markerWrite.SetData(data); 
 
	Console.WriteLine("Writing the marker"); 
	codecs.WriteMarker(destFileName, 1, markerWrite); 
 
	// read the markers from the file and check for ours 
	IList<RasterMarkerMetadata> markers = codecs.ReadMarkers(destFileName); 
	RasterMarkerMetadata markerRead = null; 
	for (int i = 0; i < markers.Count && markerRead == null; i++) 
	{ 
		if (markers[i].Id == markerWrite.Id) 
			markerRead = markers[i]; 
	} 
 
	Assert.IsTrue(markerRead.Id == markerWrite.Id); 
	byte[] dataRead = markerRead.GetData(); 
	byte[] dataWrite = markerWrite.GetData(); 
	Assert.IsTrue(dataRead.Length == dataWrite.Length); 
	for (int i = 0; i < dataRead.Length; i++) 
		Assert.IsTrue(dataRead[i] == dataWrite[i]); 
 
	codecs.Dispose(); 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

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

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