Skip to content


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Version License Platform

Example gif image

As seen on iOS App screenshot 1 screenshot 2


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

pod "BKAsciiImage"


Using BKAsciiConverter class

Import BKAsciiConverter header file

#import <BKAsciiImage/BKAsciiConverter.h>

Create a BKAsciiConverter instance

BKAsciiConverter *converter = [BKAsciiConverter new];

Convert synchronously

UIImage *inputImage = [UIImage imageNamed:@"anImage"];
UIImage *asciiImage = [converter convertImage:inputImage];

Convert in the background providing a completion block. Completion block will be called on the main thread.

[converter convertImage:self.inputImage completionHandler:^(UIImage *asciiImage) {
	// do whatever you want with the resulting asciiImage

Convert to NSString

NSLog(@"%@",[converter convertToString:self.inputImage]);

// asynchronous
[converter convertToString:self.inputImage completionHandler:^(NSString *asciiString) {

Converter options

converter.backgroundColor = [UIColor whiteColor]; // default: Clear color. Image background is transparent
converter.grayscale = YES; // default: NO
converter.font = [UIFont fontWithName:@"Monaco" size:13.0]; // default: System font of size 10
converter.reversedLuminance = NO; // Reverses the luminance mapping. Reversing gives better results on a dark bg. default: YES
converter.columns = 50; // By default columns is derived by the font size if not set explicitly

Using UIImage category

Import header file

#import <BKAsciiImage/UIImage+BKAscii.h>

Use the provided category methods

UIImage *inputImage = [UIImage imageNamed:@"anImage"];
[inputImage bk_asciiImageCompletionHandler:^(UIImage *asciiImage) {
[inputImage bk_asciiStringCompletionHandler:^(NSString *asciiString) {

[inputImage bk_asciiImageWithFont: [UIFont fontWithName:@"Monaco" size:13.0]
                          bgColor: [UIColor redColor];
                          columns: 30
                         reversed: YES
                        grayscale: NO
                completionHandler: ^(NSString *asciiString) {
					// do whatever you want with the resulting asciiImage

Advanced usage

By default luminance values are mapped to strings using

NSDictionary *dictionary = @{  @1.0: @" ",
                               @0.9 :@",",
                               @0.8 :@"-",
                               @0.7 :@"+",
                               @0.6 :@">",
                               @0.5 :@"=",
                               @0.3 :@"%",
                               @0.1 :@"X",
                               @0.0 :@"@"

You can instantiate a converter with your own mapping dictionary

NSDictionary *dictionary = @{  @1.0: @" ",
                               @0.7 :@"a",
                               @0.6 :@"c",
                               @0.5 :@"e",
                               @0.3 :@"g",
                               @0.1 :@" ",
                               @0.0 :@" "

BKAsciiConverter *converter = [[BKAsciiConverter alloc] initWithDictionary:dictionary];
UIImage *inputImage = [UIImage imageNamed:@"anImage"];
UIImage *asciiImage = [converter convertImage:inputImage];

Mapping example screenshot


Barış Koç,


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