public void CreateProcessedImages() { processedImages = new List <Image>(); foreach (Document.Item item in Document.Items) { Document.IntermediateImage intermediateImage = item.IntermediateImage; Bitmap processedBitmap = new Bitmap(intermediateImage.Width * XIncrement, intermediateImage.Height, PixelFormat.Format24bppRgb); for (int y = 0; y < intermediateImage.Height; y++) { for (int x = 0; x < intermediateImage.Width; x++) { /* from 0 to 15 */ int pen = intermediateImage.Data[(y * intermediateImage.Width) + x]; /* from 0 to 26 */ int color = 0; // default color if (pen < Document.GetCPCPaletteIndices().Count) { color = Document.GetCPCPaletteIndices()[pen]; } /* argb */ int argb = Document.GetCPCPalette()[color]; Color processedColor = Color.FromArgb(argb); int xStart = x * XIncrement; for (int i = 0; i < XIncrement; i++) { processedBitmap.SetPixel(xStart + i, y, processedColor); } } } processedImages.Add((Image)processedBitmap); } }