{"id":1454,"url":"https://github.com/bkoc/BKAsciiImage","last_synced_at":"2025-08-02T04:31:16.762Z","repository":{"id":30365096,"uuid":"33917626","full_name":"bkoc/BKAsciiImage","owner":"bkoc","description":"Convert UIImage to ASCII art","archived":false,"fork":false,"pushed_at":"2015-04-24T22:56:57.000Z","size":3952,"stargazers_count":431,"open_issues_count":1,"forks_count":34,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-07-08T12:48:45.190Z","etag":null,"topics":["ascii-art","converter","image-processing","ios","objective-c","uiimage"],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bkoc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-14T07:36:41.000Z","updated_at":"2025-02-26T16:17:08.000Z","dependencies_parsed_at":"2022-08-21T01:50:57.561Z","dependency_job_id":null,"html_url":"https://github.com/bkoc/BKAsciiImage","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/bkoc/BKAsciiImage","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bkoc%2FBKAsciiImage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bkoc%2FBKAsciiImage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bkoc%2FBKAsciiImage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bkoc%2FBKAsciiImage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bkoc","download_url":"https://codeload.github.com/bkoc/BKAsciiImage/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bkoc%2FBKAsciiImage/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268334611,"owners_count":24233793,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ascii-art","converter","image-processing","ios","objective-c","uiimage"],"created_at":"2024-01-05T20:15:46.835Z","updated_at":"2025-08-02T04:31:16.270Z","avatar_url":"https://github.com/bkoc.png","language":"Objective-C","funding_links":[],"categories":["Media","UI"],"sub_categories":["Image","Other free courses"],"readme":"# BKAsciiImage\n\n[![Version](https://img.shields.io/cocoapods/v/BKAsciiImage.svg?style=flat)](http://cocoapods.org/pods/BKAsciiImage)\n[![License](https://img.shields.io/cocoapods/l/BKAsciiImage.svg?style=flat)](http://cocoapods.org/pods/BKAsciiImage)\n[![Platform](https://img.shields.io/cocoapods/p/BKAsciiImage.svg?style=flat)](http://cocoapods.org/pods/BKAsciiImage)\n\n\n![Example gif image](./Screenshots/example.gif)\n\n### As seen on Cmd.fm iOS App\n\nhttps://itunes.apple.com/app/cmd.fm-radio-for-geeks-hackers/id935765356\n\n![Cmd.fm screenshot 1](./Screenshots/cmdfm_01.jpg)\n![Cmd.fm screenshot 2](./Screenshots/cmdfm_02.jpg)\n\n## Installation\n\nBKAsciiImage is available through [CocoaPods](http://cocoapods.org). To install it, simply add the following line to your Podfile:\n\n```ruby\npod \"BKAsciiImage\"\n```\n\n## Usage\n\n### Using BKAsciiConverter class\n\nImport BKAsciiConverter header file\n\n```objective-c\n#import \u003cBKAsciiImage/BKAsciiConverter.h\u003e\n```\n\nCreate a BKAsciiConverter instance\n\n```objective-c\nBKAsciiConverter *converter = [BKAsciiConverter new];\n```\n\nConvert synchronously\n\n```objective-c\nUIImage *inputImage = [UIImage imageNamed:@\"anImage\"];\nUIImage *asciiImage = [converter convertImage:inputImage];\n```\n\nConvert in the background providing a completion block. \nCompletion block will be called on the main thread.\n\n```objective-c\n[converter convertImage:self.inputImage completionHandler:^(UIImage *asciiImage) {\n\t// do whatever you want with the resulting asciiImage\n}];\n```\n\nConvert to NSString\n```objective-c\nNSLog(@\"%@\",[converter convertToString:self.inputImage]);\n\n// asynchronous\n[converter convertToString:self.inputImage completionHandler:^(NSString *asciiString) {\n    NSLog(@\"%@\",asciiString);\n}];\n```\n\n#### Converter options\n\n```objective-c\nconverter.backgroundColor = [UIColor whiteColor]; // default: Clear color. Image background is transparent\nconverter.grayscale = YES; // default: NO\nconverter.font = [UIFont fontWithName:@\"Monaco\" size:13.0]; // default: System font of size 10\nconverter.reversedLuminance = NO; // Reverses the luminance mapping. Reversing gives better results on a dark bg. default: YES\nconverter.columns = 50; // By default columns is derived by the font size if not set explicitly\n```\n\n### Using UIImage category\n\nImport header file\n\n```objective-c\n#import \u003cBKAsciiImage/UIImage+BKAscii.h\u003e\n```\n\nUse the provided category methods\n\n```objective-c\nUIImage *inputImage = [UIImage imageNamed:@\"anImage\"];\n[inputImage bk_asciiImageCompletionHandler:^(UIImage *asciiImage) {\n        \n}];\n    \n[inputImage bk_asciiStringCompletionHandler:^(NSString *asciiString) {\n\t\n}];\n\n[inputImage bk_asciiImageWithFont: [UIFont fontWithName:@\"Monaco\" size:13.0]\n                          bgColor: [UIColor redColor];\n                          columns: 30\n                         reversed: YES\n                        grayscale: NO\n                completionHandler: ^(NSString *asciiString) {\n\t\t\t\t\t// do whatever you want with the resulting asciiImage\n\t\t\t\t}];\n```\n\n## Advanced usage\n\nBy default luminance values are mapped to strings using \n\n```objective-c\nNSDictionary *dictionary = @{  @1.0: @\" \",\n                               @0.95:@\"`\",\n                               @0.92:@\".\",\n                               @0.9 :@\",\",\n                               @0.8 :@\"-\",\n                               @0.75:@\"~\",\n                               @0.7 :@\"+\",\n                               @0.65:@\"\u003c\",\n                               @0.6 :@\"\u003e\",\n                               @0.55:@\"o\",\n                               @0.5 :@\"=\",\n                               @0.35:@\"*\",\n                               @0.3 :@\"%\",\n                               @0.1 :@\"X\",\n                               @0.0 :@\"@\"\n                               };\n```\n\nYou can instantiate a converter with your own mapping dictionary\n\n```objective-c\nNSDictionary *dictionary = @{  @1.0: @\" \",\n                               @0.7 :@\"a\",\n                               @0.65:@\"b\",\n                               @0.6 :@\"c\",\n                               @0.55:@\"d\",\n                               @0.5 :@\"e\",\n                               @0.35:@\"f\",\n                               @0.3 :@\"g\",\n                               @0.1 :@\" \",\n                               @0.0 :@\" \"\n                               };\n\n\n\nBKAsciiConverter *converter = [[BKAsciiConverter alloc] initWithDictionary:dictionary];\nUIImage *inputImage = [UIImage imageNamed:@\"anImage\"];\nUIImage *asciiImage = [converter convertImage:inputImage];\n```\n\n![Mapping example screenshot](./Screenshots/mappingExample.jpg)\n\n## Author\n\nBarış Koç, https://github.com/bkoc\n\n## License\n\nBKAsciiImage is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbkoc%2FBKAsciiImage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbkoc%2FBKAsciiImage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbkoc%2FBKAsciiImage/lists"}