graphics - Need C# function to convert grayscale TIFF to black & white (monochrome/1BPP) TIFF -


I need a C # function that will take the [byte] of an 8 bit grayscale TIFF, and a byte [] Will return a 1-bit (black and white) TIFF

I'm fairly new to working with TIFFs, but the general idea is to give them grayscale or color black and white / monochrome / binary image formats.

If we receive images through a WCF as a byte [], then we need to turn this conversion to black & amp; To make them white, they have a component that sends in the further process.

For reference, in our test client, we create bytes in this way: [

 < Code> filestream fs = new filestream ("test1.tif", open flamemode, file accessed. Read); This.image = new byte [fs.Length]; Fs.Read (this.image, 0, System.Convert.ToInt32 (fs.Length)); Fs.Close ();  

-------- UPDATE ---------

I think there can be more than 1 good answer here, But we used code from CodeProject site to accept the following method in byte to overload the convert function [] as well as bitmap:

  public static byte [] ConvertToBitonal (Byte [] original) {bitmap BM = new bitmap (new system. IOM memorystream (original, incorrect)); BM = convertTobitonal (BM); System.IO.MemoryStream s = New System.IO.MemoryStream (); Bm Save (s, system. Drawing imaging.imageformat tif); Return s Toare (); }  

There is an article on CodeProject that describes what you need.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -