Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adjust ¶
type Adjust struct {
// Gamma correction.
// Accepted values are 0.0 to 5.0.
// Values less that 1.0 are darker while values greater than 1.0 are lighter.
// Default value is 0.
Gamma float64 `yaml:"gamma" validate:"gte=0.0,lte=5.0"`
// Percentage value.
// Accepted values are -100 to 100.
// Negative values are grayer.
// Default value is 0.
Contrast float64 `yaml:"contrast" validate:"gte=-100,lte=100"`
// Percentage value.
// Accepted values are -100 to 100.
// Lower negative values are darker while higher positive values are lighter.
// Default value is 0.
Brightness float64 `yaml:"brightness" validate:"gte=-100,lte=100"`
// Percentage value.
// Accepted values are -100 to 100.
// Negative values decrease image saturation while positive values increase image saturation.
// Default value is 0.
Saturation float64 `yaml:"saturation" validate:"gte=-100,lte=100"`
// Grayscale version.
// Default value is false.
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.
type Effect ¶
type Effect struct {
// Sigma parameter allows to control the strength of the blurring effect.
// Accepted values are 0.0 to 5.0.
// Default value is 0.
GaussianBlur float64 `yaml:"gaussian_blur" validate:"gte=0.0,lte=5.0"`
// Sharpen uses gaussian function internally.
// Accepted values are 0.0 to 5.0.
// Default value is 0.
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 {
// Desired width in pixels.
// Zero value will resize image proportionally to height.
// Default value is 0.
Width int `yaml:"width" validate:"gte=0,lte=7680"`
// Desired height in pixels.
// Zero value will resize image proportionally to width.
// Default value is 0.
Height int `yaml:"height" validate:"gte=0,lte=7680"`
// Whether to allow for upscaling.
// Default value is false.
Upscale bool `yaml:"upscale"`
// 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 {
// Automatically fix orientation after processing.
// Default value is false.
AutoOrientation bool `yaml:"auto_orientation"`
// Rotate clockwise by certain angle in degrees.
// Accepted values are 0 90 180 270.
// Default value is 0.
Rotate uint16 `yaml:"rotate" validate:"oneof=0 90 180 270"`
// Flip on a certain axis.
// Accepted values are Vertical and Horizontal.
// Default value is None.
Flip string `yaml:"flip" default:"None" validate:"oneof=None Vertical Horizontal"`
}
Transform represents a bunch of opinionated image transform options.
Click to show internal directories.
Click to hide internal directories.