Creates a new set of metadata.
Syntax

[C#]

Metadata();
Metadata(byte[] data);
Metadata(Stream stream);
Metadata(string file);

[Visual Basic]

Sub New()
Sub New(data As Byte())
Sub New(stream As Stream)
Sub New(file As String)
Params
Name Description
data A data from which to load the metadata.
stream A stream from which to load the metadata.
file A file from which to load the metadata.
Notes

This allows you to load different kinds of metadata from an image. These metadata types are typicallly a list of items referring to different properties.

You may wish to use these items for information or you can modify them and insert them back into the file.

Indeed you can also copy the metadata between files if this is useful to you.

The Metadata class supports IPTC (International Press Telecommunications Council) data, EXIF data and Photoshop IRB (Image Resource Block) data.

See Also

ImageInfo

ParseJpeg

Example

[C#]

string Truncate(string value, int n) {
  return value.Length < n ? value : value.Substring(0, n - 3) + "...";
}
Metadata metadata = new Metadata(Server.MapPath("rez/Safety_Helmet.tif"));
Response.WriteLine();
Response.WriteLine("IPTC:");
foreach (var item in metadata.Iptc)
  Response.WriteLine($"{item.DataSet} {item.Record} {item.Name} is {Truncate(item.Text, 20)}<br/>");
Response.WriteLine();
Response.WriteLine("EXIF:");
foreach (var item in metadata.Exif)
  Response.WriteLine($"{item.Tag} {item.Name} is {Truncate(item.Value, 20)}<br/>");
Response.WriteLine();
Response.WriteLine("Photoshop:");
foreach (var item in metadata.Photoshop)
  Response.WriteLine($"{item.ID} {item.Name} Length {item.Data.Length}<br/>");


This produces the following output.

IPTC:
0 2 Record Version is 
120 2 Caption is In Space...
40 2 Special Instructions is This image is the...
90 2 City is Auckland 
101 2 Country Name is New Zealand 
116 2 Copyright Notice is In Space...
EXIF:
254 Tag_00fe is 0 
256 ImageWidth is 1400 pixels 
257 ImageLength is 1000 pixels 
...