Return to Snippet

Revision: 55379
at February 4, 2012 05:18 by caringprogrammer

Initial Code
Bitmap comments = null;
            string input = "somepath";
            // Open a Stream and decode a TIFF image
            using (Stream imageStreamSource = new FileStream(input, FileMode.Open,                 FileAccess.Read, FileShare.Read))
                TiffBitmapDecoder decoder = new TiffBitmapDecoder(imageStreamSource,   BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);

                BitmapSource bitmapSource = decoder.Frames[0];
                using (Bitmap b = BitmapFromSource(bitmapSource))
                    Rectangle cropRect = new Rectangle(169, 1092, 567, 200);
                    comments = new Bitmap(cropRect.Width, cropRect.Height);

                    //first cropping
                    using (Graphics g = Graphics.FromImage(comments))
                        g.DrawImage(b, new Rectangle(0, 0, comments.Width, comments.Height),

Initial URL

Initial Description
Sample code to read tiff in C# and cropp it

Initial Title
How to read  tiff in C# and crop it

Initial Tags

Initial Language