image_conversions

package
v1.13.1 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2022 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const MAX_VAL float64 = 255

For each individual element of imgSet in ConvertToASCIISlice()

Variables

View Source
var (

	// Structure for braille dots
	BrailleStruct = [4][2]int{
		{0x1, 0x8},
		{0x2, 0x10},
		{0x4, 0x20},
		{0x40, 0x80},
	}

	BrailleThreshold uint32
)

Functions

func ConvertToAsciiChars added in v1.6.0

func ConvertToAsciiChars(imgSet [][]AsciiPixel, negative, colored, grayscale, complex, colorBg bool, customMap string, fontColor [3]int) ([][]AsciiChar, error)

Converts the 2D image_conversions.AsciiPixel slice of image data (each instance representing each compressed pixel of original image) to a 2D image_conversions.AsciiChar slice

If complex parameter is true, values are compared to 70 levels of color density in ASCII characters. Otherwise, values are compared to 10 levels of color density in ASCII characters.

func ConvertToAsciiPixels added in v1.2.0

func ConvertToAsciiPixels(img image.Image, dimensions []int, width, height int, flipX, flipY, full, isBraille, dither bool) ([][]AsciiPixel, error)

This function shrinks the passed image according to specified or default dimensions. Stores each pixel's grayscale and RGB values in an AsciiPixel instance to simplify getting numeric data for ASCII character comparison.

The returned 2D AsciiPixel slice contains each corresponding pixel's values

func ConvertToBrailleChars added in v1.7.0

func ConvertToBrailleChars(imgSet [][]AsciiPixel, negative, colored, grayscale, colorBg bool, fontColor [3]int, threshold int) ([][]AsciiChar, error)

Converts the 2D image_conversions.AsciiPixel slice of image data (each instance representing each compressed pixel of original image) to a 2D image_conversions.AsciiChar slice

Unlike ConvertToAsciiChars(), this function calculates braille characters instead of ascii

Types

type AsciiChar added in v1.2.0

type AsciiChar struct {
	OriginalColor string
	SetColor      string
	Simple        string
	RgbValue      [3]uint32
}

type AsciiPixel added in v1.2.0

type AsciiPixel struct {
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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