private void Button_Export_Click(object sender, EventArgs e) { SplitConfig config = new SplitConfig { OutputPath = @"D:\Development\D2A\images", FileNames = new string[][] { new string[] { "2s", "3s", "4s", "5s", "6s", "7s", "8s", "9s", "ts", "js", "qs", "ks", "as" }, new string[] { "2d", "3d", "4d", "5d", "6d", "7d", "8d", "9d", "td", "jd", "qd", "kd", "ad" }, new string[] { "2c", "3c", "4c", "5c", "6c", "7c", "8c", "9c", "tc", "jc", "qc", "kc", "ac" }, new string[] { "2h", "3h", "4h", "5h", "6h", "7h", "8h", "9h", "th", "jh", "qh", "kh", "ah" } } }; splitterControl.Export(config, ParseSize(), imageName ?? ""); Windows.MessageBox.Show("Images saved successfully"); }
public void Export(SplitConfig config, Size size, string imageName) { Bitmap[][] parts = GetParts(); using (PartProcessor processor = new PartProcessor(parts)) { processor.CropParts(); processor.ScaleParts(size); parts = processor.Parts; for (int x = 0; x < parts.Length; x++) { for (int y = 0; y < parts[x].Length; y++) { if (config.FileNames[y][x] == null) { continue; } string filePath = config.OutputPath + @"\" + config.FileNames[y][x] + "_" + imageName + ".jpg"; parts[x][y].Save(string.Format(filePath, x, y)); parts[x][y].Dispose(); } } } }