Skip to content

DenisovichDev/image-to-ascii

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Image to ASCII Converter in C

This programme comverts a bitmap image to an ASCII art. It uses a C library that I wrote to read the bmp image data, then maps each pixel to an ASCII character. I have done a couple of iterations of this project, including an animated version. This project is nothing but a practice, and I am well aware of the fact that this could have been done in 2 minutes using p5.js or processing. I just tried to have fun doing this in extremely low level.

Examples

                   ..
          . .,,,,  -,
   ., -=- .,:,.,:- -.  .
      ~*=..:.    ~~~-,..
     ...,.-.      =*!!=;-.
    .. . ,:       :*!!!!*!:,
      :~..~,    .-=!!!!!!!**:
    .:-   .~    .,==;===!!!!*;
    ,~            ~=;;;;;=!!!*;
    ,.           .;=;;;;;;;=!!*:
    ,-          .~,~====;;;;=!!*-
     :,         ..  :*!!!=;;;=!!=.
     .:~            ,;=**!!;;;=!*-
    . .;. .         ,, ,~=*!=:;!*;
   ,,  ,:~.         -,   .:*!;;=!!.
   :... :,  ..     .: ..   :!!:;!*~
    ,:- -~  .~,   ,:,.      ;!;;!*:
    ,;:  ~-..-:-~~~, *:     ,*!:=*;
     ,.   -~:,.....  ..  ,.  =*;=*;
           ....,        .=:  ~!;;!;
     ..     .;:- .:;=!!!!!!- :!;;==,
       ..    -:.  ;!;:;::;!- :==;;=,
       .-         :!     .!- .!!!!:
                  ~!.    .!,  =!!!:
                  ,*,    ,!,..;!!!~
                  .!-    .!,::~!!!-
     ..         . .!;;=;::=;==;==!:
   .==;;;;;;;;;;=- =!=;=!!=!!!===!=.
    :!=========!=. ;!-.~~===!!====!-
    .!!!!!!!!!!!: ,~,-:--;;!!!====!,
    .=!!!!!!!!!!~ ::-=!=~,;!!!=====
     =!==!!!===!- :--!!!:,;=====;=;
     ;=;;=!!:;;!. :~-;!=-:;==!===!!~
     :=:;;;=;:;=,.-!-,~--:!=;=;;=!!!,
     .==;, ,===-...~:=~,!~-!====~;!!;
      ,:~   -:-     -:~~-  -~,:~ ..,,
                   ..,
                 .-~~-,.
               ,--,,,,,-..,
              ~:,.,..,,,,-~~
             ~~-,.......,,,~
            ~-,........ .,.,,
           .:,. .......  ...:.
           .~..-:;~-,,,,.  .:.
           -- ~!==;;:::~,..,:
           -,,!!;;;;;::::, ,-
           .~;!=;;::::::;~.,,
           -~;!!=;:;;;::;~.,,
           :~;=:~~~:~-,-~~-,,
           -~--. .,,.. ..-~.,
           .-~:,,.~~,,,,-:,..
            -;=;:-::,-~:~:-,.
            ,=;;~~;;-,~~~:-~
            .==-,~;:~,,~;:--
             ;;,,..,..,,:~,
             ~- .,,.,,..,,.
             ,..,,:::-,,.,.
             ...~~-~--~,..,.
              ..~;::~~-... ,
              . ,~-,--. ,, --
              -: ,,.,,..~-.:=~.
          ..,,!*. .,.. -:,,;;=:~~,
        ,;=;-~*;--  ..-:-,:;:::==;--.
       ~!!;~:!*~,=~,,-~~,-:::~::;;:==,
      ,*!;:;=!*: ~;~-~~,,~~::~~~-:;=;;~.
     .:!;:~!!**=..~~~-----~:~~:~~-;=::;;
    -=:!;~:!!*;~, -~~~~--~:;:::~~:=:;:~:
   ~*;;;~-:!*!;:~..-::--~~:;:::~~;;::,~~
  :!*;:;-,:!#=;=~~..;:--~~;;:::~~;:~-~;;
 ;=!=--;-,;!*::=:;~.:~~:~:=::;:~~:~~~~:;
:!!=---:~-;!;-~:;;:::,:=:;::::~,~:~~~-~;
==*;,--~-:==:,::::~~,-;:-~~~~---:~:~~-~;
;!=~-~,,-:;!:-::~::~-~;~-~~~~--:~-:~~-~:

Running the Code

This works only in Unix-like operating systems (WSL works). Compile the project with make, and run it:

$ make
$ ./a.out

You can change the image you wanna use in main.c. Why not use command line arguments? Too lazy.

About

Bitmap image to ASCII converter

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published