mosaic

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2019 License: MIT Imports: 9 Imported by: 0

README

mosaic

Go Report Card GoDoc

A collage generator primarily designed to generate stunning playlist thumbnails

Composers

Composer samples

Command Line

The command to generate a composition is simple:

mosaic generate --output <file> <image>...

This will generate a composition with a suitable composer (for the given amount of images) and save it at the given location.

The following options are available.

OPTIONS:
    --composer value, -c value  use specific composer (default: random)
    --output value, -o value    path to write output image to
    --width value               width of composition (default: 512, or same as height if set)
    --height value              height of composition (default: 512, or same as width if set)
    --help, -h                  show help (default: false)

Use mosaic generate -h for more details.

Documentation

Overview

Package mosaic provides various composers to generate image collages.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidImageCount is the error returned, when an invalid amount of
	// images is passed to a composer.
	ErrInvalidImageCount = errors.New("invalid number of images")
)

Functions

func CirclesPie

func CirclesPie(dc *gg.Context, images ...image.Image) error

func RegisterComposer

func RegisterComposer(comps ...ComposerInfo) error

RegisterComposer registers the given

func StripesVertical

func StripesVertical(dc *gg.Context, images ...image.Image) error

func StripesVerticalMulti

func StripesVerticalMulti(dc *gg.Context, images ...image.Image) error

func TilesDiamond

func TilesDiamond(dc *gg.Context, images ...image.Image) error

func TilesFocused

func TilesFocused(dc *gg.Context, images ...image.Image) error

func TilesPerfect

func TilesPerfect(dc *gg.Context, images ...image.Image) error

Types

type Composer

type Composer interface {
	// Compose draws the images to the drawing context.
	Compose(dc *gg.Context, images ...image.Image) error
}

A Composer creates image compositions

type ComposerFunc

type ComposerFunc func(dc *gg.Context, images ...image.Image) error

A ComposerFunc is a Composer which itself is a function.

func (ComposerFunc) Compose

func (f ComposerFunc) Compose(dc *gg.Context, images ...image.Image) error

Compose calls the underlying function with the given arguments.

type ComposerInfo

type ComposerInfo struct {
	Composer

	Id          string
	Name        string
	Description string

	ImageCountHuman string
	CheckImageCount func(count int) bool

	RecommendedImageCounts []int
}

ComposerInfo is a Composer with additional information.

func GetComposer

func GetComposer(id string) (ComposerInfo, bool)

GetComposer returns the composer with the given id.

func GetComposers

func GetComposers() []ComposerInfo

GetComposers returns a slice containing all composers.

func RecommendComposers added in v0.0.2

func RecommendComposers(count int) []ComposerInfo

RecommendComposers returns a slice of composers which are suitable for the given image count.

func (ComposerInfo) RecommendImageCount

func (ci ComposerInfo) RecommendImageCount(imageCount int) int

RecommendImageCount recommends a suitable amount of images to use which is guaranteed to be less or equal to the amount provided.

Directories

Path Synopsis
cmd
internal
app/mosaicc
Package mosaicc contains the logic for the mosaic cli.
Package mosaicc contains the logic for the mosaic cli.
pkg
geom
Package geom contains utilities for working with geometry.
Package geom contains utilities for working with geometry.

Jump to

Keyboard shortcuts

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