private static void CheckPixelFormat(PixelFormat format) { // check pixel format if ((format != PixelFormat.Format8bppIndexed)) { throw new UnsupportedImageFormatException("Unsupported pixel format of the source image."); } }