convert

package
v0.0.0-...-d09d7ef Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2017 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package convert provides the core ASCII art conversion function.

Index

Constants

View Source
const CharacterAspectRatio = 1.0 / 2.0

CharacterAspectRatio gives the percentage by which input images' heights will be scaled relative to their native aspect ratio. Characters in most fonts are taller than they are wide, and are even taller when the space between lines is taken into account, resulting in output ASCII "pixels" that are not square.

Variables

This section is empty.

Functions

This section is empty.

Types

type ASCIIArt

type ASCIIArt [][]byte

ASCIIArt is the output of asciist's image conversion. The top-level slice contains the lines of the ASCII art (y axis), and each inner slice contains the bytes of each line (x axis).

func FromImage

func FromImage(img image.Image, width uint) ASCIIArt

FromImage converts the given image to ASCII art, where each line is `width` characters wide, and the height of the output is chosen to preserve the input aspect ratio (taking into account that ASCII "pixels" are not square; see CharacterAspectRatio).

func (ASCIIArt) String

func (img ASCIIArt) String() string

String builds a string of the art by converting each line to a string and joining them with newline characters.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL