All Projects → bkoc → Bkasciiimage

bkoc / Bkasciiimage

Licence: mit
Convert UIImage to ASCII art

Projects that are alternatives of or similar to Bkasciiimage

Png To Ico
convert png to ico format
Stars: ✭ 88 (-79.1%)
Mutual labels:  image-processing, converter
Ascii art
Real-Time ASCII Art Rendering Library
Stars: ✭ 599 (+42.28%)
Mutual labels:  image-processing, ascii-art
Logorain Ascii Art
Logorain-ASCII-Art: A simple Image to ASCII Art converter
Stars: ✭ 24 (-94.3%)
Mutual labels:  image-processing, ascii-art
Picharsso
🎨 A utility for converting images to text art.
Stars: ✭ 100 (-76.25%)
Mutual labels:  image-processing, ascii-art
Swiftuiimageeffects
Swift port of Apple UIImage+UIImageEffecs category.
Stars: ✭ 213 (-49.41%)
Mutual labels:  image-processing, uiimage
Imgtoascii
A JavaScript implementation of a image to Ascii code
Stars: ✭ 331 (-21.38%)
Mutual labels:  image-processing, ascii-art
Nyximageskit
A set of efficient categories for UIImage class. It allows filtering, resizing, masking, rotating, enhancing... and more.
Stars: ✭ 2,553 (+506.41%)
Mutual labels:  image-processing, uiimage
Tocropviewcontroller
A view controller for iOS that allows users to crop portions of UIImage objects
Stars: ✭ 4,210 (+900%)
Mutual labels:  image-processing, uiimage
Beam
✨ Expressive WebGL
Stars: ✭ 383 (-9.03%)
Mutual labels:  image-processing
Blogger Cli
A cli tool to convert and manage jupyter notebook blogs. Proudly host your notebooks even as a static site.
Stars: ✭ 404 (-4.04%)
Mutual labels:  converter
Doc2dash
Create docsets for Dash.app-compatible API browser.
Stars: ✭ 380 (-9.74%)
Mutual labels:  converter
Kornia
Open Source Differentiable Computer Vision Library
Stars: ✭ 5,615 (+1233.73%)
Mutual labels:  image-processing
Asciimg
An ascii image generator written in Java.
Stars: ✭ 402 (-4.51%)
Mutual labels:  ascii-art
Awesome Image Registration
image registration related books, papers, videos, and toolboxes
Stars: ✭ 380 (-9.74%)
Mutual labels:  image-processing
Stonks
Stonks is a terminal based stock visualizer and tracker that displays realtime stocks in graph format in a terminal. See how fast your stonks will crash.
Stars: ✭ 405 (-3.8%)
Mutual labels:  ascii-art
Sharp
High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP, AVIF and TIFF images. Uses the libvips library.
Stars: ✭ 21,131 (+4919.24%)
Mutual labels:  image-processing
Curated List Of Awesome 3d Morphable Model Software And Data
The idea of this list is to collect shared data and algorithms around 3D Morphable Models. You are invited to contribute to this list by adding a pull request. The original list arised from the Dagstuhl seminar on 3D Morphable Models https://www.dagstuhl.de/19102 in March 2019.
Stars: ✭ 375 (-10.93%)
Mutual labels:  image-processing
Breakdance
It's time for your markup to get down! HTML to markdown converter. Breakdance is a highly pluggable, flexible and easy to use.
Stars: ✭ 418 (-0.71%)
Mutual labels:  converter
Resizer
An image resizing library for Android
Stars: ✭ 406 (-3.56%)
Mutual labels:  image-processing
Snowy
Small Image Library for Python 3
Stars: ✭ 401 (-4.75%)
Mutual labels:  image-processing

BKAsciiImage

Version License Platform

Example gif image

As seen on Cmd.fm iOS App

https://itunes.apple.com/app/cmd.fm-radio-for-geeks-hackers/id935765356

Cmd.fm screenshot 1 Cmd.fm screenshot 2

Installation

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

pod "BKAsciiImage"

Usage

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) {
    NSLog(@"%@",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.95:@"`",
                               @0.92:@".",
                               @0.9 :@",",
                               @0.8 :@"-",
                               @0.75:@"~",
                               @0.7 :@"+",
                               @0.65:@"<",
                               @0.6 :@">",
                               @0.55:@"o",
                               @0.5 :@"=",
                               @0.35:@"*",
                               @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.65:@"b",
                               @0.6 :@"c",
                               @0.55:@"d",
                               @0.5 :@"e",
                               @0.35:@"f",
                               @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

Author

Barış Koç, https://github.com/bkoc

License

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].