Adds or changes an item of IPTC information.
Syntax

[C#]

IPTCRecord Add(string inField, bool inReplace);

[Visual Basic]

Function Add(inField As String, inReplace As Boolean) As IPTCRecord
Params
Name Description
inField The field to be modified.
inReplace Whether to replace any existing fields of the same name.
return The item which was added.
Notes

Use this method to add a new item of information.

You can refer to fields either using the common names or using a more formal "Record:DataSet" format as defined in the IPTC specification.

For example the "Headline" field is defined as part of Record 2 DataSet 105. This means you can use either of the following two methods to enter a headline.

[Visual Basic]
iptc.Add("Headline", True).Text = "Oxford University Ball" iptc.Add("2:105", True).Text = "Oxford University Ball"

[C#]
iptc.Add("Headline", True).Text = "Oxford University Ball"; iptc.Add("2:105", True).Text = "Oxford University Ball";

The IPTC specification allows you to embed more than one field with the same name. When dealing with fields such as headlines or captions you will typically want to replace any existing fields. However for some types of data such as keywords, you may wish to add to an existing set of entries rather than replace them all.

ImageGlue recognizes the following common names:

  • "Record Version"
  • "Object Type Reference"
  • "Object Attribute Reference"
  • "Object Name"
  • "Edit Status"
  • "Editorial Update"
  • "Urgency"
  • "Subject Reference"
  • "Category"
  • "Supplemental Category"
  • "Fixture Identifier"
  • "Keyword"
  • "Content Location Code"
  • "Content Location Name"
  • "Release Date"
  • "Release Time"
  • "Expiration Date"
  • "Expiration Time"
  • "Special Instructions"
  • "Action Advised"
  • "Reference Service"
  • "Reference Date"
  • "Reference Number"
  • "Date Created"
  • "Time Created"
  • "Digital Creation Date"
  • "Digital Creation Time"
  • "Originating Program"
  • "Program Version"
  • "Object Cycle"
  • "Byline"
  • "Byline Title"
  • "City"
  • "Sub-location"
  • "Province-State"
  • "Country Code"
  • "Country Name"
  • "Original Transmission Reference"
  • "Headline"
  • "Credit"
  • "Source"
  • "Copyright Notice"
  • "Contact"
  • "Caption"
  • "Local Caption"
  • "Caption Writer"
  • "Image Type"
  • "Image Orientation"
  • "Language Identifier"
  • "Audio Type"
  • "Audio Sampling Rate"
  • "Audio Sampling Resolution"
  • "Audio Duration"
  • "Audio Outcue"
  • "ObjectData Preview File Format"
  • "ObjectData Preview File Format Version"
  • "ObjectData Preview Data"

Note that information changes are not applied until the Embed method is called.

See Also

Embed

Delete

Example

[C#]

Canvas canvas = new Canvas(Server.MapPath("rez/balloons.tif"));
byte[] theData = canvas.GetAs("dummy.jpg");
IPTCData iptc = new IPTCData();
iptc.Add("Headline", true).Text = "What a Regatta!";
iptc.Add("Keyword", true).Text = "boat";
iptc.Add("Keyword", false).Text = "sea";
iptc.Add("Keyword", false).Text = "naval";
theData = iptc.Embed(theData);
// ... insert theData as BLOB


[Visual Basic]

Dim canvas As New Canvas(Server.MapPath("rez/balloons.tif"))
Dim theData As Byte() = canvas.GetAs("dummy.jpg")
Dim iptc As New IPTCData()
iptc.Add("Headline", True).Text = "What a Regatta!"
iptc.Add("Keyword", True).Text = "boat"
iptc.Add("Keyword", False).Text = "sea"
iptc.Add("Keyword", False).Text = "naval"
' ... insert theData as BLOB
theData = iptc.Embed(theData)


This example draws a TIFF into a canvas. It then gets the canvas contents in JPEG format and embeds a headline and some keywords into the image. Finally it writes the data to a database (code not shown).