tiles

package
v0.0.0-...-d3ac9a9 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultTileSize — default tile size px
	DefaultTileSize = 50
)

Variables

This section is empty.

Functions

func PrepareTiles

func PrepareTiles(sourceDir string, targetDir string, tileSize int) error

PrepareTiles prepares tiles from images found in sourceDir and stores them to targetDir. If tileSize is 0, then DefaultTileSize is used instead.

Types

type AvgColor

type AvgColor [3]float64

AvgColor is average color of image

func NewAvgColor

func NewAvgColor(img image.Image) AvgColor

NewAvgColor returns average color of the img

func (AvgColor) B

func (c AvgColor) B() float64

B is blue component

func (AvgColor) G

func (c AvgColor) G() float64

G is green component

func (AvgColor) R

func (c AvgColor) R() float64

R is red component

type DistanceCalculator

type DistanceCalculator func(AvgColor, AvgColor) float64

Color distance calculator

var (
	ColorDistanceEuclidean DistanceCalculator = euclideanDistance
	ColorDistanceRedmean   DistanceCalculator = redMeanDistance
)

type Library

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

func NewLibrary

func NewLibrary(tilesDir string, tileSize int, dc DistanceCalculator) (*Library, error)

func (Library) FindTile

func (l Library) FindTile(subImage image.Image) (image.Image, error)

func (Library) TileSize

func (l Library) TileSize() int

TileSize returns size of tiles in library

Jump to

Keyboard shortcuts

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