LiulietLee / ImageToASCII

Transforming an image to ASCII characters

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ImageToASCII

A model about transforming an image to ASCII characters written by Swift.

Install

Just move the "Source/LLTransformer.swift" to your project.

Usage

You can download this project to see the simple example.

let transformer = LLTransformer()
let yourImage = UIImage(named: "your_image_title.png")
let text = transformer.convertUIImageToText(image: yourImage, clarity: 98)
label.text = text     // or some other cool things

The convertUIImageToText(image: UIImage, clarity: Int) -> String function return a string and it has two arguements:

  • image: The UIImage which will be converted.
  • clarity: It's greater than 0 and smaller than 100. The greater the argurment, the clearer the string picture.

About

Transforming an image to ASCII characters


Languages

Language:Swift 100.0%