Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>My company's product, <a href="http://www.atalasoft.com/" rel="nofollow noreferrer">dotImage</a>, will do this.</p> <p>Given an image, you can convert from multi-bit to single bit using several methods including simple threshold, global threshold, local threshold, adaptive threshold, dithering (ordered and Floyd Steinberg), and dynamic threshold. The right choice depends on the type of the input image (document, image, graph).</p> <p>The typical code looks like this:</p> <pre><code>AtalaImage image = new AtalaImage("path-to-tiff", null); ImageCommand threshold = SomeFactoryToConstructAThresholdCommand(); AtalaImage finalImage = threshold.Apply(image).Image; </code></pre> <p>SomeFactoryToConstructAThresholdCommand() is a method that will return a new command that will process the image. It could be as simple as</p> <pre><code>return new DynamicThresholdCommand(); </code></pre> <p>or</p> <pre><code>return new GlobalThresholdCommand(); </code></pre> <p>And generally speaking, if you're looking to convert an entire multi-page tiff to black and white, you would do something like this:</p> <pre><code>// open a sequence of images FileSystemImageSource source = new FileSystemImageSource("path-to-tiff", true); using (FileStream outstm = new FileStream("outputpath", FileMode.Create)) { // make an encoder and a threshold command TiffEncoder encoder = new TiffEncoder(TiffCompression.Auto, true); // dynamic is good for documents -- needs the DocumentImaging SDK ImageCommand threshold = new DynamicThreshold(); while (source.HasMoreImages()) { // get next image AtalaImage image = source.AcquireNext(); AtalaImage final = threshold.Apply(image).Image; try { encoder.Save(outstm, final, null); } finally { // free memory from current image final.Dispose(); // release the source image back to the image source source.Release(image); } } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload