public void Apply(Func <Image, Image> action, Func <Image, bool> where) { var images = performAction(action, where); var res = InMemoryTiff.Merge(this.DefaultFormat, images); res.SaveTo(@"C:\test.tif"); this.Image = res.Image; this.MemoryStream = res.MemoryStream; }
/// <summary> /// Removes specified pages from current image /// </summary> /// <param name="pageIndexes"></param> public void RemovePages(params int[] pageIndexes) { var usefulPages = Enumerable.Range(0, this.PageCount).Where(i => !pageIndexes.Contains(i)); var newImg = InMemoryTiff.Merge(this.DefaultFormat, this.GetPages(usefulPages, this.DefaultFormat.XPage)); this.MemoryStream = newImg.MemoryStream; this.Image = newImg.Image; }
public void RemoveImages(Func <Image, bool> where) { var usefulImages = this.Split().Select(tiff => tiff.Image).Where(image => !where (image)); var newImg = InMemoryTiff.Merge(this.DefaultFormat, usefulImages); this.MemoryStream = newImg.MemoryStream; this.Image = newImg.Image; }
public static void SaveTiffs(Dictionary <int, List <InMemoryTiff> > splitDic, string folder) { foreach (var key in splitDic.Keys) { string filePath = string.Format("{0}_{1}.tif", DateTime.Now.ToString("yyyyMMddHHmmss"), key); TiffEncodingFormat tiffEncodingFormat = new TiffEncodingFormat(splitDic[key].Count); InMemoryTiff tempInMemoryTiff = InMemoryTiff.Merge(tiffEncodingFormat, splitDic[key].ToArray()); tempInMemoryTiff.SaveTo(folder + filePath); tempInMemoryTiff.SaveTo(TiffEncodingFormats.Tiff1Bpp, folder + filePath); tempInMemoryTiff.Dispose(); } }