←Select platform

Markers Property

Summary
The collection of marker data used when reading and writing certain file formats (including JPEG).
Syntax
C#
Objective-C
C++/CLI
Java
Python
public ObservableCollection<RasterMarkerMetadata> Markers { get; } 
@property (nonatomic, assign, readonly, nullable) NSMutableArray<LTRasterMarkerMetadata *> *markers 
public RasterCollection<RasterMarkerMetadata> getMarkers(); 
public: 
property ObservableCollection<RasterMarkerMetadata^>^ Markers { 
   ObservableCollection<RasterMarkerMetadata^>^ get(); 
} 
Markers # get  (RasterImage) 

Property Value

A collection of RasterMarkerMetadata used when reading and writing certain file formats (including JPEG).

Remarks

Several formats allow you to store non-image data such as comments, tags, and markers.

You can manipulate the markers of an image by adding/removing RasterMarkerMetadata objects to this collection.

By setting the CodecsSaveOptions.Markers property to true before calling RasterCodecs.Save, you can save the markers in this collection when the image is saved into a file.

By setting the CodecsLoadOptions.Markers property to true before calling RasterCodecs.Load, you can load all the markers (if any) into this collection when an image is loaded from a file.

You can use the RasterCodecs.ReadMarkers method to load the markers directly from an existing file and the RasterCodecs.WriteMarkers method to save the markers to an existing file.

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 MarkersExample() 
{ 
	RasterCodecs codecs = new RasterCodecs(); 
	RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE1.CMP")); 
 
	byte[] byteData = new byte[1]; 
	byteData[0] = 40; 
	// write APP5 (since nobody writes that) 
	RasterMarkerMetadata markerData = new RasterMarkerMetadata(RasterMarkerMetadata.App0 + 5, byteData); 
	image.Markers.Add(markerData); 
 
	codecs.Options.Save.Markers = true; 
	codecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "IMAGE1_MARKERS.JPG"), RasterImageFormat.Jpeg, 0); 
 
	// load the marker together with the image 
	IList<RasterMarkerMetadata> marker = codecs.ReadMarkers(Path.Combine(LEAD_VARS.ImagesDir, "IMAGE1_MARKERS.JPG")); 
	// look for the APP5 marker, because there might be other markers (like APP0, APP1) 
	foreach (RasterMarkerMetadata markerItem in marker) 
		if (markerItem.Id == RasterMarkerMetadata.App0 + 5) 
			Console.WriteLine("marker Id :" + markerItem.Id.ToString() + " = " + markerItem.GetData().ToString()); 
 
	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.