Documentation
¶
Index ¶
- Variables
- func AddColorToPalette(c color.Color, p color.Palette) color.Palette
- func ColorToHexString(c color.Color) string
- func GetContentType(extension string) string
- func GetImageDimensions(absPath string) (int, int, error)
- func HexStringToColor(s string) (color.Color, error)
- func ReplaceColorInPalette(c color.Color, p color.Palette)
- type Cache
- type OutputFormat
- type Processor
- type Task
Constants ¶
This section is empty.
Variables ¶
View Source
var AnchorPositions = map[string]gift.Anchor{ strings.ToLower("Center"): gift.CenterAnchor, strings.ToLower("TopLeft"): gift.TopLeftAnchor, strings.ToLower("Top"): gift.TopAnchor, strings.ToLower("TopRight"): gift.TopRightAnchor, strings.ToLower("Left"): gift.LeftAnchor, strings.ToLower("Right"): gift.RightAnchor, strings.ToLower("BottomLeft"): gift.BottomLeftAnchor, strings.ToLower("Bottom"): gift.BottomAnchor, strings.ToLower("BottomRight"): gift.BottomRightAnchor, }
View Source
var Hints = map[string]webpoptions.EncodingPreset{ "picture": webpoptions.EncodingPresetPicture, "photo": webpoptions.EncodingPresetPhoto, "drawing": webpoptions.EncodingPresetDrawing, "icon": webpoptions.EncodingPresetIcon, "text": webpoptions.EncodingPresetText, }
These encoding hints are currently only relevant for Webp.
View Source
var ImageFilters = map[string]gift.Resampling{ strings.ToLower("NearestNeighbor"): gift.NearestNeighborResampling, strings.ToLower("Box"): gift.BoxResampling, strings.ToLower("Linear"): gift.LinearResampling, strings.ToLower("Hermite"): hermiteResampling, strings.ToLower("MitchellNetravali"): mitchellNetravaliResampling, strings.ToLower("CatmullRom"): catmullRomResampling, strings.ToLower("BSpline"): bSplineResampling, strings.ToLower("Gaussian"): gaussianResampling, strings.ToLower("Lanczos"): gift.LanczosResampling, strings.ToLower("Hann"): hannResampling, strings.ToLower("Hamming"): hammingResampling, strings.ToLower("Blackman"): blackmanResampling, strings.ToLower("Bartlett"): bartlettResampling, strings.ToLower("Welch"): welchResampling, strings.ToLower("Cosine"): cosineResampling, }
Functions ¶
func AddColorToPalette ¶
AddColorToPalette adds c as the first color in p if not already there. Note that it does no additional checks, so callers must make sure that the palette is valid for the relevant format.
func ColorToHexString ¶
ColorToHexString converts a color to a hex string.
func GetContentType ¶ added in v0.1.27
func GetImageDimensions ¶ added in v0.1.27
Types ¶
type OutputFormat ¶ added in v0.1.27
type OutputFormat int
OutputFormat is the image format to output to
const ( // JPEG represents the JPEG format JPEG OutputFormat = iota // WebP represents the WebP format WebP )
func GetOutputFormat ¶ added in v0.1.27
func GetOutputFormat(extension string) OutputFormat
type Processor ¶ added in v0.1.27
type Processor struct {
// contains filtered or unexported fields
}
Processor is an image processor that uses vips to process images
func New ¶ added in v0.1.27
func New(ctx context.Context, log *logger.Logger, tracer *tracing.Tracer, workers int, cache *Cache) (*Processor, error)
New initializes a new processor instance
type Task ¶ added in v0.1.27
type Task struct {
ImageID string
Width int
Height int
ApplyBlur bool
BlurAmount int
ApplyGrayscale bool
UserComment string
OutputFormat OutputFormat
}
Task is an image processing task
Source Files
¶
Click to show internal directories.
Click to hide internal directories.