Binarify

- 2 mins

No, I’m not making the “there are 10 kinds of people in this world” joke.

Binarify is a python package that lets you convert any image to binary.

Let’s take a picture of the spidercat. png

Let’s Binarify it.

000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000110000000000000000000000000000000000000
000000000000000000000000000000000000010000000000000000000000000000000000000
000000000000000000000000000000000000010000000000000000000000000000000000000
000000000000000000000000000000000000010000000000000000000000000000000000000
000000000000000000000000000000000000010000000000000000000000000000000000000
000000000000000000000000000000000000010000000000000000000000000000000000000
000000000000000000000000000000000000010000000000000000000000000000000000000
000000000000000000000000000000000000010000000000000000000000000000000000000
000000000000000000000000000000000000010000000000000000000000000000000000000
000000000000000000000000000000000000010000000000000000000000000000000000000
000000000000000000000000000000000000110000000000000000000000000000000000000
000000000000000000000000000000000000010100000000000000000000000000000000000
000000000000000000000000011000000000010000000000000000000000000000000000000
000000000000000000000000100110000000010000000000000000000000000000000000000
000000000000000000000000010001000000010000000000000000000000000000000000000
000000000000000000000000010000110000011000000000000000000000000000000000000
000000000000000000000000001000101100011000000000000000000000000000000000000
000000000000000000000000011100011100111011111110000000000000000000000000000
000000000000000000000000000011000000011100000010110000000000000000000000000
000000000000000000000000000001111111110000000000110000000000000000000000000
000000000000000000000000000000000000010110000000001100000000000000000000000
000000000000000000000000000000000000110010000000001000000000000000000000000
000000000000000000000000000000000011001011000011111000000000000000000000000
000000000000000000000000000000001110001101100011010000000000000000000000000
000000000000000000000000000000011110001111000000100000000000000000000000000
000000000000000000000000000000110110000011101000011000000000000000000000000
000000000000000000000000000001110100000001110100000000000000000000000000000
000000000000000000000000000001001100000001101110000000000000000000000000000
000000000000000000000000000001101100000001101110000000000000000000000000000
000000000000000000000000000001101100000000100110000000000000000000000000000
000000000000000000000000000001111100000001101010000000000000000000000000000
000000000000000000000000000000100110000001001011111000000000000000000000000
000000000000000000000000000000111111000011001011111100000000000000000000000
000000000000000000000000000000000011010100100111111100000000000000000000000
000000000000000000000000000000011100010000001000011110000000000000000000000
000000000000000000000000000000000000011000000000001110000000000000000000000
000000000000000000000000000000000000000000000000000111000000000000000000000
000000000000000000000000000001111100010001101000000011100000000000000000000
000000000000000000000000000011100110111011110111000000110000000000000000000
000000000000000000000000011100110111111011011101110000010000000000000000000
000000000000000000000000111011110111111011011010111000000000000000000000000
000000000000000000000000010111111000101000111011000100000000000000000000000
000000000000000001111101101111000011011110000111101111111100000000000000000
000000000000000000000011100111001111011111100110101110000000000000000000000
000000000000001100000011101100110100000001011001101110000001100000000000000
000000000010000000000011111111101111110110011111110111000000000010000000000
000000000000000000000010011110111110111010011111110011000000000000000000000
000000000000000000000011011101111110000110111111110111000000000000000000000
000000000000000000000011010011111111011011111111110111000000000000000000000
000000000000000000000011011111111111110111111111110111000000000000000000000
000000000000000000000011111111111111011101111111110000000000000000000000000
000000000000000000000011111111111100101001111111111111000000000000000000000
000000000000000000000011111111110110000011011111111111000000000000000000000
000000000000000000000011011110011101101101110101111110000000000000000000000
000000000000000000000001010010111000101100110110011110000000000000000000000
000000000000000000000000001111111110100011110111100000000000000000000000000
000000000000000000000000110111001101101111110111011000000000000000000000000
000000000000000000000000111010110111101101011010111100000000000000000000000
000000000000000000000000110000111000100000111110011100000000000000000000000
000000000000000000000000101111101111101110111011101100000000000000000000000
000000000000000000000000011111100111101111011111110100000000000000000000000
000000000000000000000000111111100000000000000111111100000000000000000000000
000000000000000000000000011110000000000000000001111000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000001111101100000000000000000000000000000000
000000000000000000000001111111111111111111111111111100000000000000000000000
000000000000000000000011111111111111111111111111111110000000000000000000000
000000000000000000000000000111111111111111111111000000000000000000000000000

What is Binarify

Binarify is a python script that lets you convert any image to a binary image resembling the input image.

In other words, it replicates an image with 1’s and 0’s.

Setup

Make sure you have the following packages installed before usage:

Use Binarify

  1. Clone this repo.
  2. Typical usage often looks like :
      python binarify.py -input path/to/image.jpg -output path/to/output/text/file -mode black -width 120
    
  3. Check the output.txt file for the text version of the same.

Support Me

If you :heart: it, :star: this repository.

Help me translate this README into other languages. :smile:

Check out my other work too either on Github or on my website.

Enjoy!


Follow @RohitMidha23

Star

rss facebook twitter github gitlab youtube mail spotify lastfm instagram linkedin google google-plus pinterest medium vimeo stackoverflow reddit quora quora