←Select platform

ReadMarkers(Stream) Method

Summary
Reads all the metadata markers (COM and APPn) from a stream.
Syntax
C#
Objective-C
C++/CLI
Java
Python
public IList<RasterMarkerMetadata> ReadMarkers( 
   Stream stream 
) 
- (nullable NSArray<LTRasterMarkerMetadata *> *)readMarkersFromStream:(LTLeadStream *)stream error:(NSError **)error 
public List<RasterMarkerMetadata> readMarkers(ILeadStream stream) 
public: 
IList<RasterMarkerMetadata^>^ ReadMarkers(  
   Stream^ stream 
)  
def ReadMarkers(self,stream): 

Parameters

stream
A Stream containing the input file image data.

Return Value

A collection of RasterMarkerMetadata objects containing the metadata marker data.

Remarks

This method reads all the metadata markers from a file, and returns a collection of the markers.

Typically, JPEG and Exif JPEG files contain markers. Call RasterCodecs.MarkersSupported to find out if a certain file format supports markers.

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.

The marker data in APPn markers will typically start with a string identifying the type of data present in the marker. For example, the APP1 Exif marker will usually start with the 4-byte string "Exif" followed by 2 bytes of 0x00. That is because there can be many types of data stored in an APP1 marker. This simple convention is a good way of distinguishing between an Exif APP1 marker and another type of APP1 marker.

If the file contains no marker, then this method will return an empty collection.

Example

This example will read all the markers from a stream that contains an EXIF file data

C#
Java
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.ImageProcessing; 
using Leadtools.ImageProcessing.Color; 
using Leadtools.Svg; 
 
 
void ReadMarkersFromStreamExample(Stream theStream) 
{ 
   RasterCodecs codecs = new RasterCodecs(); 
 
   IList<RasterMarkerMetadata> markers = codecs.ReadMarkers(theStream); 
   Debug.WriteLine("{0} markers found with the following ID's:", markers.Count); 
   foreach (RasterMarkerMetadata marker in markers) 
      Debug.WriteLine(marker.Id); 
 
   codecs.Dispose(); 
} 
 
import java.io.*; 
import java.net.*; 
import java.nio.file.Paths; 
import java.util.*; 
import java.time.Instant; 
import java.time.Duration; 
 
import org.junit.*; 
import org.junit.runner.JUnitCore; 
import org.junit.runner.Result; 
import org.junit.runner.notification.Failure; 
import static org.junit.Assert.*; 
 
import leadtools.*; 
import leadtools.codecs.*; 
import leadtools.codecs.RasterCodecs.FeedCallbackThunk; 
import leadtools.drawing.internal.*; 
import leadtools.imageprocessing.*; 
import leadtools.imageprocessing.color.ChangeIntensityCommand; 
import leadtools.svg.*; 
 
 
public void readMarkersFromStreamExample() throws IOException { 
   final String LEAD_VARS_IMAGES_DIR = "C:\\LEADTOOLS23\\Resources\\Images"; 
   final String exifFileName = "cannon.jpg"; 
   RasterCodecs codecs = new RasterCodecs(); 
 
   ILeadStream ls = LeadStreamFactory.create(combine(LEAD_VARS_IMAGES_DIR, exifFileName)); 
   List<RasterMarkerMetadata> markers = codecs.readMarkers(ls); 
   System.out.println(markers.size() + " markers found with the following ID's:"); 
 
   for (RasterMarkerMetadata marker : markers) 
      System.out.println(marker.getId()); 
 
   ls.close(); 
   codecs.dispose(); 
} 
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.