/// <summary> /// Merge (multi-page) TIFF images /// For very big images consider using <seealso cref="MergeToFile"/> /// </summary> public static InMemoryTiff Merge(TiffEncodingFormat format, IEnumerable <Image> images) { var tiff = new InMemoryTiff(images.First()); tiff.Append(images.Skip(1)); return(tiff); }
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; }
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; }
/// <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 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(); } }
/// <summary> /// Merge (multi-page) TIFF images /// For very big images consider using <seealso cref="MergeToFile"/> /// </summary> public static FileSystemTiff Merge(TiffEncodingFormat format, string outFile, IEnumerable <Image> images) { return(InMemoryTiff.MergeToFile(format, outFile, images)); }