Change color image to black & white image by adjusting dither through command line

  For some reason, sometimes we need to convert color RGB images to B&W image. In this article, I will show you one method of converting color image to B&W image by adjusting dither. I use software VeryPDF OCR to Any Converter CMD, which allows you rotate, threshold, dither, resample, flip, mirror on image and set color depth to new image file with 1, 4, 8, 16, 24, 32 bitcount. In the following part, I will show you how to use it.

Step 1. Download OCR to Any Converter Command Line

  • When downloading finishes, there will be an zip file. Please extract it to some folder then you can call the executable file in MS Dos Windows.
  • And this is Window application now it can not work under Mac and Linux system.

Step 2. Know more about dither technology

  Dither is an intentionally applied form of noise used to randomize quantization error, preventing large-scale patterns such as color banding in images. Dither is routinely used in processing of both digital audio and digital video data, and is often one of the last stages of audio production to compact disc. And it is often used to reduce banding in GIFs with graduated color transitions. Most software provides options that let you control the appearance of the scattered pixels. Now let us check some dithering effect from the following snapshot.

dithering effect

Step 3. Change color image to image B & W by command line

  • When you run the conversion, please refer to the usage and examples in readme.txt.
  • Usage:   ocr2any.exe [options] <PDF-file> <Text-file>
  • When you change color image to image B & W by command line, please refer to the following command line templates.
  • ocr2any.exe -dither 0 test_color.tif _test\_test_color.tif.dither0.tif
    Here you can change color image tiff file to black and white tiff file using value -dither 0. And there are following values for you to choose:
    dither <int>           : convert the color image to B&W using the desired method:
        -dither 0: Floyd-Steinberg
        -dither 1: Ordered-Dithering (4x4)
        -dither 2: Burkes
        -dither 3: Stucki
        -dither 4: Jarvis-Judice-Ninke
        -dither 5: Sierra
        -dither 6: Stevenson-Arce
        -dither 7: Bayer (4x4 ordered dithering)

    ocr2any.exe -dither 7 -resizewidth 200 -resizeheight 200 test_color.tif _test\_test_color.tif.dither7.tif
    By this command line, we can use Bayer (4x4 ordered dithering) to change color tiff file to black and white tiff file. Meanwhile by this software we can resize image width and height.
    Here are related parameters.
    -resizewidth <int>      : resize the image's width, only availalbe when -resizeheight used
    -resizeheight <int>     : resize the image's height, only availalbe when -resizewidth used

Now let us check the dithering effect from the following snapshots. During the using, if you have any question, please contact us as soon as possible.

input jpg file
                          Input Jpg file.

output tiff
                   Dithering Tiff file

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

This entry was posted in OCR Products and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


Verify Code   If you cannot see the CheckCode image,please refresh the page again!