Skip to content

Instantly share code, notes, and snippets.

View abbasadel's full-sized avatar

Abbas Adel Ibraim abbasadel

View GitHub Profile
@aessam
aessam / image2ascii.py
Last active December 24, 2016 04:18
The scripts convert images to ascii art, it count pixels for character and use it as base for color density.
"""
The basic idea is that I loop through all characters and count the number of
pixels and make <Hashtable number of pixels as a key and character as value>
The table will not have 255 value so to cover this I had to calculate the
slope of change as a base step for the colors.
example, if we have 50 value and we need 255 value, then each 255/50 = 5.1
Then with each gray color we will devied by 5 so we have index to
be fetched from the keys of the pixels table