This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

HOWTO: Add Multiple Keywords in IPTC

I can't figure out how to add multiple keywords in the IPTC keyword field.
I'm trying the following code:

using (Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap(file)) {
                JpegEncoderOptions options= new JpegEncoderOptions(70, false);
                IptcDictionary iptc = new IptcDictionary();
// here is where I set the keywords
                iptc[IptcDictionary.Keyword]  = "one, two, three, four";
               options.Iptc = iptc;
                bitmap.Save(file, options);
}


When I then open the file in Photoshop, for example, it tells me that there is one keyword: "one, two, three, four".
I've tried splitting the keywords by semicolon and putting quotes around them, the problem remains.

Thanks for ideas and experience shared!
Hello,

To add multiple meta-data values you need to specify them as arrays. Here is the code showing how to do this:

Aurigma.GraphicsMill.Bitmap bmp = new Aurigma.GraphicsMill.Bitmap(400, 400, 
    Aurigma.GraphicsMill.PixelFormat.Format24bppRgb);
Aurigma.GraphicsMill.Codecs.JpegFrame frame = new Aurigma.GraphicsMill.Codecs.JpegFrame(bmp, 
    100, false);
         
Aurigma.GraphicsMill.Codecs.IptcDictionary iptc = new Aurigma.GraphicsMill.Codecs.IptcDictionary();
object [] keywords = new object[2];
keywords[0] = "keyword1";
keywords[1] = "keyword2";
iptc.Add(Aurigma.GraphicsMill.Codecs.IptcDictionary.Keyword, keywords);

Aurigma.GraphicsMill.Codecs.JpegWriter writer = new Aurigma.GraphicsMill.Codecs.JpegWriter(
    @"d:/temp/MultipleIptc.jpg");
writer.Iptc = iptc;
writer.AddFrame(frame);
writer.Close();