title: Create custom palette for WritableBitmap from 256 Colours
body: <p>I have now been looking for almost an hour and just couldn't find an answer. I am currently working on a program that displays a custom image (using WritableBitmap) either in a gray scale or a colourscale with 256 predetermined colours.</p>
  
  <p>The input for the image will be an array of bytes (which works fine if I set the PixelFormat property to PixelFormats.Gray8), but since I need a custom colour scale too, I would like to create custom scales (one for gray and one or more for colours). I think what I need to use is the PixelFormat.Indexed8 property, but I simply can't find out how to use that and how to create a custom colour palette and the internet was not at all helpful on how to create one.</p>