Git Product home page Git Product logo

image_to_char's Introduction

Image_to_Char

What is this?

This simple program in C++ reads an image file and "draws" it using ASCII characters.

How does it work?

Nothing too fancy, actually. This program is only able to handle PGM file as of now (first version), it agglutinates together a square block of pixels and gets its mean value (gray scale). The size of the square block used can be changed altering the MAX_WIDTH variable (more on that in the next section).

Having the mean value of each group of pixels, we map it for 4 different Extended ASCII characters (█, ▓, ▒ or <white_space> ) and write it to a notepad.

How do I use it?

First, you will need a .pgm format of your image, which you can obtain using online conversion tools (just type 'png to pgm on DuckDuckGo' and you should be able to find it). Put the .pgm file in the 'src' folder.

Next, into the image_to_char.cpp file (inside src), change the 'capivara.pgm' string to the name of your .pgm or file, or, alternatively, keep it to run the example of the capybara, already in the folder, along with its original .png file so you can easily visualize it.

For running the program you will also need a C++ compiler. Compile all .cpp files in src folder and run the executable generated.

Once the program finishes running, you should be able to find a 'Text.txt' file in the project directory. Open it (and possibly zoom out using 'ctrl -') to see the "image" generated.

Note that you can also change the "resolution" of the drawing by changing the 'MAX_WIDTH' variable. A greater value generates a better "resolution".

E-mail me, if any doubts: [email protected]

image_to_char's People

Contributors

viniciusariel avatar vinytt avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.