public static Color[] QuantizeColors(this Bitmap image)
		{
			if (image.HasPalette()) return image.Palette.Entries;
			var pix = image.Bitmap32ToPixels().Flat();
			var oct = new OctTree();
			foreach (var c in pix)
			{
				oct.Add(c);
			}
			var tabla = oct.Read();
			return tabla;
		}
		public static Bitmap ToIndexFormat(this Bitmap image, Color[] palette)
		{
			var sz = image.Size;
			var res = new Bitmap(sz.Width, sz.Height, PixelFormat.Format8bppIndexed);
			res.SetPalette(palette);
			var bmpdataori = image.Bitmap32ToPixels();
			var bmpdatadest = new byte[sz.Height][];
			var dic = new Dictionary<int, int>();
			for (var f = 0; f < sz.Height; f++)
			{
				var pixelsori = bmpdataori[f];
				var pixeldest = ReduceLine(pixelsori, palette,dic);
				bmpdatadest[f] = pixeldest;
				Debug.Print($"Scanline {f} colors {dic.Count}");
			}
			res.PixelsToBitmap8(bmpdatadest);
			return res;
		}