Combines an existing JPEG with the current IPTC information.


byte[] Embed(byte[] inData);
string Embed(string inPath);

[Visual Basic]

Function Embed(inData As Byte()) As Byte()
Function Embed(inPath As String) As String
Name Description
inData The raw JPEG data.
inPath A path to the existing JPEG.
return The new JPEG - see below for details.

Use this method to add the current IPTC information to an existing JPEG. You can specify your JPEG using either a file path or using raw data - an array of bytes.

If you pass this function a path to your JPEG it will return the same path. If you pass this function raw data it will return an array of data representing the new JPEG image.


[C#]string theFile = Server.MapPath("rez/iptc.jpg");
XImageLoadOptions loadOptions = new XImageLoadOptions();
loadOptions.ReadIPTC = true;
XImage image = XImage.FromFile(theFile, loadOptions);
if (image.IPTC != null) {
  image.IPTC.Add("Headline", true).Text = "Oxford University Ball";
  image.IPTC.Add("Caption", true).Text = "What a laugh!";

[Visual Basic]Dim theFile As String = Server.MapPath("rez/iptc.jpg")
Dim loadOptions As New XImageLoadOptions()
loadOptions.ReadIPTC = True
Dim image As XImage = XImage.FromFile(theFile, loadOptions)
If image.IPTC IsNot Nothing Then
  image.IPTC.Add("Headline", True).Text = "Oxford University Ball"
  image.IPTC.Add("Caption", True).Text = "What a laugh!"
End If

The code reads the IPTC information from a JPEG file. It then changes the headline and caption and embeds the changed information into the original file.