Extract frame from multi page tiff - c# -
There is a multi page quarrel and I want to remove page [n] / frame [n] from this tiff file and I want to save.
If there are 3 frames in my multi page shock, then after removing a page / frame - I
only 1 page with 2 page / frame containing
1 image / Frame
There is some code to save the last frame to a single-page tiff file a multi-frame quarrel. (To use this code, you must add the presentation to the context of DLL).
Stream image stream source = new file stream (image file name, filemod. Open, file accessed. Read, fileshare.read); MemoryStream memstream = new MemoryStream (); Memstream.SetLength (imageStreamSource.Length); ImageStreamSource.Read (memstream.GetBuffer (), 0, (int) imageStreamSource.Length); ImageStreamSource.Close (); Bitmapcoder decoder = tiffbitmapdicoder.creative (mystream, bitmapreut option; prerender pixel format, bitmap option. Default); Int32 framecount = decoder.frame.count; Bitmapframe imageframe = decoder Frame [0]; Memorystream output = new memorystream (); TiffBitmapEncoder encoder = new TIFFmitmap encoder (); Encoder.frames.Add (imageFrame); Encoder.Save (production); File stream outstream = file. OpenRight ("Image .tiff"); Output.WriteTo (outStream); OutStream.Flush (); OutStream.Close (); Output.flush (); Output.Close ();
Comments
Post a Comment