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

Notification

Icon
Error

Options
Go to last post Go to first unread
bz3x  
#1 Posted : Thursday, November 13, 2008 5:24:39 AM(UTC)
bz3x

Rank: Newbie

Groups: Guest
Joined: 11/13/2008(UTC)
Posts: 4

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

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!

Edited by moderator Monday, May 28, 2012 8:34:37 PM(UTC)  | Reason: Not specified

Dmitry  
#2 Posted : Thursday, November 13, 2008 2:08:45 PM(UTC)
Dmitry

Rank: Advanced Member

Groups: Guest
Joined: 8/3/2003(UTC)
Posts: 1,070

Thanks: 1 times
Was thanked: 12 time(s) in 12 post(s)
Hello,

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

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();
Sincerely yours,
Dmitry Sevostyanov

UserPostedImage Follow Aurigma on Twitter!
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.