Skip to content

tobiohlala/Asciify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Asciify

PowerShell Gallery Codacy Badge

Convert Images to ASCII Pictures

preview

Description

Convert any image to ASCII picture by representing each pixels grayscale value as an ASCII character. The higher the grayscale value resp. the lighter the pixel the more space the corresponding ASCII character fills on the screen therefore reassembling the image well on dark console backgrounds with light font colors. On light console backgrounds with dark font colors use the -Invert switch to adjust. Before being processed the image will be resized in memory to make the resulting ASCII picture fit the console's width later on. To fit the console's height instead use the -FitConsoleHeight switch. Otherwise, if you don't want the resulting ASCII picture's dimensions determined by the script automatically at all you can specify a custom width and height using the -Width and -Height parameters. This can be useful when exporting ASCII pictures of custom sizes into textfiles, e.g (Note: i2a is an alias for Convert-ImageToAscii):

gci .\bobby-fischer.jpg | i2a -Width 160 -Height 80 -Resolution Mid -Invert > .\bobby-fischer.txt

Note: -Width and -Height must be specified manually when running the Cmdlet from PowerShell hosts not reporting its console dimensions like PowerShell ISE.

Furthermore, the Cmdlet supports three different resolutions regarding the resulting ASCII picture. These are Low, Mid and High and can be specified by the -Resolution parameter. On higher resolutions the resulting ASCII picture will be made up with more ASCII characters yielding a more fine-grained picture. Depending on the image a higher resolution sometimes may tend to look better especially when using smaller font sizes or bigger dimensions.

Installation

Install from PowerShell Gallery

Install-Module -Name Asciify

or

git clone https://github.com/tobiohlala/Asciify

Usage

Import-Module Asciify

Convert-ImageToAscii .\bobby-fischer.jpg

Examples

Get-Help Convert-ImageToAscii -Examples