image_conversions

package
v0.0.0-...-b7d497b Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

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

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

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

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

func ConvertToHalfBlockChars

func ConvertToHalfBlockChars(imgSet [][]AsciiPixel, negative, colored, grayscale bool) ([][]AsciiChar, error)

Types

type AsciiChar

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

type AsciiPixel

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