title: How to Change a Bitmap to another random color?
body: <p>I'm tyring to add points to a a map. And regardless of how many pins are on this map, each pin will get its own color. I want to only change the hue</p>
  
  <p>I'm using a template png that looks like this</p>
  
  <p><img src="https://i.stack.imgur.com/1VMhi.png" alt="enter image description here"></p>
  
  <p>I want to create function that when a new point occurs this file will get randomly colored.</p>
  
  <p>How would I do this?</p>
  
  <p>Code below I'm working with - I am unable to figure out how to throw random values in the matrix to output any good colors that are spaced far enough in the color palate </p>
  
  <pre><code> private Bitmap ColorMyPin()
  {
      Image imgPicture = Properties.Resources.green_MarkerBlank;
  
      Bitmap bmp = new Bitmap(imgPicture.Width, imgPicture.Height);
  
  
      ImageAttributes iaPicture = new ImageAttributes();
      ColorMatrix cmPicture = new ColorMatrix(new float[][]
      {
          new float[] {0, 0, 0, 0, 0},
          new float[] {0, 0, 0, 0, 0},
          new float[] {0, 0, 0, 0, 0},  &lt;-- //Hard part where do i throw random() values at
          new float[] {0, 0, 0, 0, 0},
          new float[] {0, 0, 0, 0, 0}
      });
  
  
      // Set the new color matrix
      iaPicture.SetColorMatrix(cmPicture);
  
      // Set the Graphics object from the bitmap
      Graphics gfxPicture = Graphics.FromImage(bmp);
  
      // New rectangle for the picture, same size as the original picture
      Rectangle rctPicture = new Rectangle(0, 0, imgPicture.Width, imgPicture.Height);
  
      // Draw the new image
      gfxPicture.DrawImage(imgPicture, rctPicture, 0, 0, imgPicture.Width, imgPicture.Height, GraphicsUnit.Pixel, iaPicture);
  
      return bmp;
  }
  </code></pre>
  
  <p>After</p>
  
  <p><img src="https://i.stack.imgur.com/vp0On.png" alt="enter image description here"></p>