convert

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CharSets = map[string]string{

	"standard": " .:-=+*#%@",
	"simple":   " .*#",
	"binary":   " █",
	"ascii":    " .,:;i1tfLCG08@",

	"detailed": " .'`^\",:;Il!i><~+_-?][}{1)(|\\/tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$",

	"blocks": " ░▒▓█",
	"shade":  " ░▒▓█▄▀▌▐",

	"braille": " ⠁⠂⠃⠄⠅⠆⠇⡀⡁⡂⡃⡄⡅⡆⡇⠈⠉⠊⠋⠌⠍⠎⠏⡈⡉⡊⡋⡌⡍⡎⡏⠐⠑⠒⠓⠔⠕⠖⠗⡐⡑⡒⡓⡔⡕⡖⡗⠘⠙⠚⠛⠜⠝⠞⠟⡘⡙⡚⡛⡜⡝⡞⡟⠠⠡⠢⠣⠤⠥⠦⠧⡠⡡⡢⡣⡤⡥⡦⡧⠨⠩⠪⠫⠬⠭⠮⠯⡨⡩⡪⡫⡬⡭⡮⡯⠰⠱⠲⠳⠴⠵⠶⠷⡰⡱⡲⡳⡴⡵⡶⡷⠸⠹⠺⠻⠼⠽⠾⠿⡸⡹⡺⡻⡼⡽⡾⡿⢀⢁⢂⢃⢄⢅⢆⢇⣀⣁⣂⣃⣄⣅⣆⣇⢈⢉⢊⢋⢌⢍⢎⢏⣈⣉⣊⣋⣌⣍⣎⣏⢐⢑⢒⢓⢔⢕⢖⢗⣐⣑⣒⣓⣔⣕⣖⣗⢘⢙⢚⢛⢜⢝⢞⢟⣘⣙⣚⣛⣜⣝⣞⣟⢠⢡⢢⢣⢤⢥⢦⢧⣠⣡⣢⣣⣤⣥⣦⣧⢨⢩⢪⢫⢬⢭⢮⢯⣨⣩⣪⣫⣬⣭⣮⣯⢰⢱⢲⢳⢴⢵⢶⢷⣰⣱⣲⣳⣴⣵⣶⣷⢸⢹⢺⢻⢼⢽⢾⢿⣸⣹⣺⣻⣼⣽⣾⣿",

	"box": " ─│┌┐└┘├┤┬┴┼━┃┏┓┗┛┣┫┳┻╋╔╗╚╝╠╣╦╩╬░▒▓█",

	"geometric": " ◦◌○◎●◐◑◒◓◔◕◖◗◘◙◚◛◜◝◞◟◠◡◢◣◤◥◦◧◨◩◪◫◬◭◮◯",

	"shapes": " ·∘○◌◎●◐◑▪▫◻◼◽◾▢▣▤▥▦▧▨▩■□▬▭▮▯",

	"math": " ·∙∘∴∵∶∷∸∹∺∻∼∽∾∿≀≁≂≃≄≅≆≇≈≉≊≋≌≍≎≏≐≑≒≓≔≕≖≗≘≙≚≛≜≝≞≟≠≡≢≣≤≥",

	"stars": " ·✦✧★☆✡✢✣✤✥✦✧✩✪✫✬✭✮✯✰✱✲✳✴✵✶✷✸✹✺✻✼✽✾✿❀❁❂❃❄❅❆❇❈❉❊❋",

	"dingbats": " ·•‣⁃⁌⁍∎∗※⁂⁎⁑⁕❖❗❘❙❚❛❜❝❞❟❠❡❢❣❤❥❦❧",

	"arrows": " →↗↑↖←↙↓↘↔↕↯⇐⇑⇒⇓⇔⇕⇖⇗⇘⇙⇚⇛⇜⇝⇞⇟⇠⇡⇢⇣⇤⇥⇦⇧⇨⇩⇪",

	"music": " ♩♪♫♬♭♮♯𝄞𝄢𝄪𝄫",

	"symbols": " ·‥…※†‡•‣⁂⁃⁎⁑⁕♠♡♢♣♤♥♦♧♨♩♪♫♬☀☁☂☃☄★☆☇☈☉☊☋☌☍☎☏",

	"ultra": " .'`^\",:;Il!i><~+_-?][}{1)(|\\/tfjrxnuvczXYUJCLQ0OZmwqpdbkhao*#MW&8%B@$░▒▓█▀▄▌▐●○◐◑◒◓■□▪▫◻◼★☆✦✧",

	"retro": " ·:;+*%#@█▓▒░",

	"dots": " ·∘○◌◎●",

	"elegant": " ·‥…∴∵∶∷⁘⁙⁚⁛⁜⁝⁞",

	"dense": " 一二三亖卅卌╳╬╫╪╩╨╧╦╥╤╣╢╡╠╟╞╝╜╛╚╙╘╗╖╕╔╓╒║═",

	"hatch": " /\\|─│┌┐└┘├┤┬┴┼╱╲╳",

	"stipple": " ⠀⠁⠂⠄⠈⠐⠠⡀⢀⣀⣠⣤⣴⣶⣷⣿",

	"dots_braille": " ⠁⠂⠃⠄⠅⠆⠇⡀⡁⡂⡃⡄⡅⡆⡇⠈⠉⠊⠋⠌⠍⠎⠏⡈⡉⡊⡋⡌⡍⡎⡏⠐⠑⠒⠓⠔⠕⠖⠗⡐⡑⡒⡓⡔⡕⡖⡗⠘⠙⠚⠛⠜⠝⠞⠟⡘⡙⡚⡛⡜⡝⡞⡟⠠⠡⠢⠣⠤⠥⠦⠧⡠⡡⡢⡣⡤⡥⡦⡧⠨⠩⠪⠫⠬⠭⠮⠯⡨⡩⡪⡫⡬⡭⡮⡯⠰⠱⠲⠳⠴⠵⠶⠷⡰⡱⡲⡳⡴⡵⡶⡷⠸⠹⠺⠻⠼⠽⠾⠿⡸⡹⡺⡻⡼⡽⡾⡿⢀⢁⢂⢃⢄⢅⢆⢇⣀⣁⣂⣃⣄⣅⣆⣇⢈⢉⢊⢋⢌⢍⢎⢏⣈⣉⣊⣋⣌⣍⣎⣏⢐⢑⢒⢓⢔⢕⢖⢗⣐⣑⣒⣓⣔⣕⣖⣗⢘⢙⢚⢛⢜⢝⢞⢟⣘⣙⣚⣛⣜⣝⣞⣟⢠⢡⢢⢣⢤⢥⢦⢧⣠⣡⣢⣣⣤⣥⣦⣧⢨⢩⢪⢫⢬⢭⢮⢯⣨⣩⣪⣫⣬⣭⣮⣯⢰⢱⢲⢳⢴⢵⢶⢷⣰⣱⣲⣳⣴⣵⣶⣷⢸⢹⢺⢻⢼⢽⢾⢿⣸⣹⣺⣻⣼⣽⣾⣿",
}

Character sets for different styles - leveraging full Unicode

Functions

func FromFile

func FromFile(path string, opts Options) (string, error)

func FromImage

func FromImage(img image.Image, opts Options) (string, error)

FromImage converts an image.Image to ASCII art

func FromReader

func FromReader(r io.Reader, opts Options) (string, error)

FromReader converts an image from io.Reader to ASCII art

func FromURL

func FromURL(url string, opts Options) (string, error)

FromURL converts an image from URL to ASCII art

func GetCharset

func GetCharset(name string) string

GetCharset returns a charset by name

func ListCharsets

func ListCharsets() []string

ListCharsets returns all available charset names

func LoadImageFile

func LoadImageFile(path string) (image.Image, error)

LoadImageFile loads an image from a file path

func LoadImageURL

func LoadImageURL(url string) (image.Image, error)

LoadImageURL loads an image from a URL

Types

type Options

type Options struct {
	Width      int    // Target width in characters (0 = auto)
	Height     int    // Target height in characters (0 = auto based on width)
	Charset    string // Characters to use (dark to light)
	Invert     bool   // Invert brightness
	EdgeDetect bool   // Use edge detection
	Color      bool   // Preserve colors (ANSI)
	Dither     bool   // Apply dithering
}

Options for ASCII conversion

func DefaultOptions

func DefaultOptions() Options

DefaultOptions returns sensible defaults

Jump to

Keyboard shortcuts

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