config

package
v0.0.9 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adjust

type Adjust struct {
	Gamma      float64 `yaml:"gamma" validate:"gte=0.0,lte=5.0"`
	Contrast   float64 `yaml:"contrast" validate:"gte=-100,lte=100"`
	Brightness float64 `yaml:"brightness" validate:"gte=-100,lte=100"`
	Saturation float64 `yaml:"saturation" validate:"gte=-100,lte=100"`
	Grayscale  bool    `yaml:"grayscale"`
}

Adjust represents a bunch of opinionated image adjust options.

type Config

type Config struct {
	InputDir  string    `yaml:"input_dir" validate:"required,dir"`
	OutputDir string    `yaml:"output_dir" validate:"required,dir"`
	Resize    Resize    `yaml:"resize"`
	Transform Transform `yaml:"transform"`
	Effect    Effect    `yaml:"effect"`
	Adjust    Adjust    `yaml:"adjust"`
}

Config represents the configuration.

func Load

func Load(path string) (*Config, error)

Load loads the configuration for a given path.

type Effect

type Effect struct {
	// Sigma parameter allows to control the strength of the blurring effect.
	GaussianBlur float64 `yaml:"gaussian_blur" validate:"gte=0.0,lte=5.0"`
	// Sharpen uses gaussian function internally.
	Sharpen float64 `yaml:"sharpen" validate:"gte=0.0,lte=5.0"`
}

Effect represents a bunch of opinionated image effect options.

type Resize

type Resize struct {
	// Resize width.
	Width uint16 `yaml:"width" validate:"gte=0,lte=7680"`
	// Resize height.
	Height uint16 `yaml:"height" validate:"gte=0,lte=7680"`
	// Resize type.
	// Accepted values are Normal, Thumbnail, Fit and Fill.
	// Default value is Normal.
	Type string `yaml:"type" default:"Normal" validate:"oneof=Normal Thumbnail Fit Fill"`
	// Resize resampling filter.
	// Accepted values are Lanczos, CatmullRom, MitchellNetravali, Linear, Box and NearestNeighbor.
	// Default value is Lanczos.
	Filter string `yaml:"filter" default:"Lanczos" validate:"oneof=Lanczos CatmullRom MitchellNetravali Linear Box NearestNeighbor"`
	// Anchor is used for image alignment when using Resize Type 'Fill'.
	// Accepted values are Center, TopLeft, Top, TopRight, Left, Right, BottomLeft, Bottom and BottomRight.
	// Default value is Center.
	Anchor string `yaml:"anchor" default:"Center" validate:"oneof=Center TopLeft Top TopRight Left Right BottomLeft Bottom BottomRight"`
}

Resize represents a bunch of opinionated image resize options.

type Transform

type Transform struct {
	AutoOrientation bool   `yaml:"auto_orientation"`
	Rotate          uint16 `yaml:"rotate" validate:"oneof=0 90 180 270"`
	Flip            string `yaml:"flip" default:"None" validate:"oneof=None Vertical Horizontal"`
}

Transform represents a bunch of opinionated image transform options.

Jump to

Keyboard shortcuts

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