/ Published in: C#

Sample code to read tiff in C# and cropp it
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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)) { //first cropping using (Graphics g = Graphics.FromImage(comments)) { cropRect, GraphicsUnit.Pixel); } } }
URL: http://caringprogrammer.blogspot.com/
Comments
