title: How to get and set propertyitems for an image
body: <p>I'm trying to understand these two methods of the Bitmap or Image. One being <code>.SetPropertyItem()</code> and the other being <code>.GetPropertyItem()</code>.</p>
  
  <p>I'm completely confused as to the way the documentation says that I am to set a property item.</p>
  
  <p>From the <a href="http://msdn.microsoft.com/en-us/library/system.drawing.image.getpropertyitem.aspx">Microsoft Documentation</a> it is stating that we should choose a property item by an id of a property item that already exist in the image, give that property item a new ID, set the properties and then set the image property item with that retrieved property item.</p>
  
  <p>That is so weird, but what really gets me is that we cannot just set the id of the property item to any ID we've got to set the property item id to an id that already exist in the property item id list.</p>
  
  <p>What is confusing is that I'm using a property that is already set by some other manner and overriding it's property and then adding it back to the image with some other existing ID from the property id list.</p>
  
  <p>What am I missing here? Is there not a way to simply create a new PropertyItem and then add that property item with any given ID to the image or bitmap?</p>
  
  <p>Here is an example of what I am talking about. The ID that is of 20752 is a propertyitem that the image already has, and when I set the ID of the PropertyItem that 20753 is an ID that the Image has as well.</p>
  
  <p><strong>This will successfully set the property item.</strong></p>
  
  <pre><code>  private void Form1_Load(object sender, EventArgs e)
      {
  
          string path = Environment.CurrentDirectory + @"\sample.png";
          Image image = Image.FromFile(path);
  
          PropertyItem pi = image.GetPropertyItem(20752);
  
          pi.Id = 20753;
  
          pi.Type = 1;
          pi.Value = Encoding.UTF8.GetBytes("MyImageInfo");
          pi.Len = pi.Value.Length;
          image.SetPropertyItem(pi);
  
          image.Save(Environment.CurrentDirectory + @"\sample2.png");
      }
  </code></pre>
  
  <p><strong>This will successfully retrieve the PropertyItem.</strong></p>
  
  <pre><code>  private void Form1_Load(object sender, EventArgs e)
          {
  
              string path = Environment.CurrentDirectory + @"\sample.png";
              Image image = Image.FromFile(path);
  
              PropertyItem propItem = image.GetPropertyItem(20753);
          }
  </code></pre>
  
  <p>It there a way that I can create a new PropertyItem with my own ID without having to do all that weird stuff? Or am I missing something here?</p>
  
  <p>And or, is the a better way to set other types of property's for an image or bitmap? I am looking for a basic way to save information and retrieve it at a later date.</p>
  
  <p>What am I doing wrong here?</p>