public virtual Bitmap To4bppBitmapUncached(int whichPalette) { Bitmap result = new Bitmap(Width, Height, System.Drawing.Imaging.PixelFormat.Format4bppIndexed); System.Drawing.Imaging.BitmapData bmd = result.LockBits(new Rectangle(Point.Empty, result.Size), System.Drawing.Imaging.ImageLockMode.WriteOnly, System.Drawing.Imaging.PixelFormat.Format4bppIndexed); ColorPalette pal = result.Palette; Palette.FixupColorPalette(pal, Palettes, whichPalette, 0); result.Palette = pal; for (int i = 0; i < Pixels.Count; i++) { bmd.SetPixel4bpp(i % Width, i / Width, Pixels[i] % 16); } result.UnlockBits(bmd); return(result); }