public string[] splitTiffPages(string sourceFile, string targetDirectory) { string[] returnImages; try { Image sourceImage = Bitmap.FromFile(sourceFile); Image[] sourceImages = splitTiffPages(sourceImage); int pageCount = sourceImages.Length; returnImages = new string[pageCount]; for (int i = 0; i < pageCount; i++) { FileInfo fi = new FileInfo(sourceFile); string babyImg = targetDirectory + "\\" + fi.Name.Substring(0, (fi.Name.Length - fi.Extension.Length)) + "_PAGE" + (i + 1).ToString().PadLeft(3, '0') + fi.Extension; sourceImages[i].Save(babyImg); returnImages[i] = babyImg; } } catch (Exception ex) { MessageBox.Show(ex.Message); returnImages = null; } return returnImages; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)