Skip to content

nickswalker/ASCIIfy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ASCIIfy

CI Status Version License Platform

Turn images to ASCII art. UIImage and NSImage extensions included.

Installation

ASCIIfy is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "ASCIIfy"

Usage

You start by poking around in the included Playground. You can do a basic conversion with just a couple lines:

let font = ASCIIConverter.defaultFont.withSize(24.0)
    let outputImage = inputImage?.fy_asciiImageWith(font, colorMode: .color)

Extensions are great. You can also build a reusable ASCIIConverter object to expose fine-grain controls:

let colorConverter = ASCIIConverter(lut: ColorLookupTable())
colorConverter.font = font
colorConverter.backgroundColor = .black
colorConverter.colorMode = .color
colorConverter.columns = 20

let colorResult = colorConverter.convertImage(flowerImage)

You can even define your own lookup table to control the characters that get used. Take a look at the ColorLookupTable to get started:

let colorConverter = ASCIIConverter(lut: ColorLookupTable())
colorConverter.font = ASCIIConverter.defaultFont.withSize(30.0)
colorConverter.backgroundColor = .black
colorConverter.columns = 30

let colorConverterResult = colorConverter.convertImage(flowerImage)

To run the example iOS and macOS projects, clone the repo, and run pod install from the Example directory.

Author

ASCIIfy is a heavily modified fork of BKAsciiImage.

License

ASCIIfy is available under the MIT license. See the LICENSE file for more info.