img2ascii

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2023 License: MIT Imports: 2 Imported by: 0

README

img2ascii

Go Reference | Go Report Card

Image to ascii (and not only) conversion library and command line tool

Usage


func ExampleImage_Encode() {
	ascii.NewImage().Encode(os.Stdout, i)
	// Output:
	// =++++***###%%%%%%%%%######****************######
	// ===+++***###%%%%%%%%%######****************#####
	// -===+++***###%%%%%%%%%######****************####
	// --===+++***###%%%%%%%%%######****************###
	// ---===+++***###%%%%%%%%%######****************##
	// ----===+++***###%%%%%%%%%######****************#
	// -----===+++***###%%%%%%%%%######****************
	// ------===+++***###%%%%%%%%%######***************
	// -------===+++***###%%%%%%%%%######**************
	// ==------===+++***###%%%%%%%%%######*************
	// ===------===+++***###%%%%%%%%%######************
	// ====------===+++***###%%%%%%%%%######***********
	// =====------===+++***###%%%%%%%%%######**********
	// ======------===+++***###%%%%%%%%%######*********
	// =======------===+++***###%%%%@%%%%######********
	// ========------===+++***###%%%@%%%%%######*******
	// =========------===+++***###%%@%%%%%%######******
	// ===#@@===@@*--@#@*%@#+*@%@%#%@%%@@@%%######*****
	// ===@*=====+@--@+=@*+@++@##@##@%%@@%@%%######****
	// ===*%%==#@@@--@--@==@++@**@##@%%@@@@%%@@#####***
	// =====%*=@++@=-@--@-=@=+@*#@**@##@@%%%%%%%#####**
	// ===@@%==#@#@==@--@--@==@%@#**@##%@@@%%%%%%######
	// ===============------==@+++****###%%%%%%%%%#####
	// -===============------=@=++++***###%%%%%%%%%####
	// --=*@@===@=======------====+++***###%%%%%%%%%###
	// ---@==@==@========-------===+++***###%%%%%%%%%##
	// ---@=====@=========-------===+++***###%%%%%%%%%#
	// --@@@=@==@==+@@*====-=%@@--+@@*++@%@%@@@%%%%%%%%
	// ---@--@==@==@*+@=====%*=---@**@++@##@%%@%%%%%%%%
	// :--@--@==@==@@@@=====@=----@==@=+@+*@*#@#%%%%%%%
	// ::-@--@-=@==@*=======%*=---%++@==@++@**@##%%%%%%
	// :::@--@--@==+@@@==@==+%@@--+@@+==@++@**@###%%%%%
	// ::::------===============-------===+++***###%%%%
	// :::::------================------===+++***###%%%
	// ::::::------================------===+++***###%%
	// :::::::------================------===+++***###%
	// ::::::::------================------===+++***###
	// :::::::::------================------===+++***##
	// -:::::::::-------===============------===+++***#
	// --:::::::::------================------===+++***
	// ---:::::::::-------===============------===+++**
	// =---:::::::::-------===============------===+++*
	// ==---:::::::::-------===============------===+++
	// ===----:::::::::------===============------===++
	// +===----:::::::::------===============------===+
	// ++===----:::::::::------===============------===
	// +++====---:::::::::------===============------==
	// *+++====---:::::::::------===============------=
}

Screenshots

ASCII

ascii

ANSI 256 colors Single Height

ansi

ANSI 256 colors Half Height

ansi half

ANSI 24bit color Single Height

24bit

ANSI 24bit color Half Height

24bit Half

Documentation

Index

Constants

View Source
const HalfHeightRatio = 9 / 11.

HalfHeightRatio represents the width/height ratio of a character for half row pixel height

View Source
const SingleHeightRatio = 9 / 22.

SingleHeightRatio represents the width/height ratio of a character for single row pixel height

Variables

This section is empty.

Functions

This section is empty.

Types

type Encoder

type Encoder interface {
	Encode(w io.Writer, m image.Image) error
	GetFontRatio() float64
}

Encoder is the interface implemented by all converters

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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