Documentation
¶
Overview ¶
Package imageflow is a fast image processing library
Index ¶
- type Black
- type Buffer
- type Color
- type Constrain
- type ConstraintGravity
- type ConstraintHint
- type DrawExact
- type ExpandCanvas
- type File
- type FitBox
- type GIF
- type LosslessPNG
- type LossyPNG
- type MarginFitBox
- type MozJPEG
- type PercentageFitBox
- type RectangleToCanvas
- type Region
- type RegionPercentage
- type Steps
- func (steps *Steps) Alpha(value float32) *Steps
- func (steps *Steps) Branch(f func(*Steps)) *Steps
- func (steps *Steps) Brightness(value float32) *Steps
- func (steps *Steps) Command(cmd string) *Steps
- func (steps *Steps) Constrain(dataMap Constrain) *Steps
- func (steps *Steps) ConstrainWithin(w float64, h float64) *Steps
- func (steps *Steps) ConstrainWithinH(h float64) *Steps
- func (steps *Steps) ConstrainWithinW(w float64) *Steps
- func (steps *Steps) Contrast(value float32) *Steps
- func (steps *Steps) CopyRectangle(f func(steps *Steps), rect RectangleToCanvas) *Steps
- func (steps *Steps) CropWhitespace(threshold int, padding float64) *Steps
- func (steps *Steps) Decode(task ioOperation) *Steps
- func (steps *Steps) DrawExact(f func(steps *Steps), rect DrawExact) *Steps
- func (steps *Steps) Encode(task ioOperation, preset presetInterface) *Steps
- func (steps *Steps) Execute() (map[string][]byte, error)
- func (steps *Steps) ExpandCanvas(canvas ExpandCanvas) *Steps
- func (steps *Steps) FillRect(x1 float64, y1 float64, x2 float64, y2 float64, color Color) *Steps
- func (steps *Steps) FlipH() *Steps
- func (steps *Steps) FlipV() *Steps
- func (steps *Steps) GIF(operation ioOperation) *Steps
- func (steps *Steps) GrayscaleBT709() *Steps
- func (steps *Steps) GrayscaleFlat() *Steps
- func (steps *Steps) GrayscaleNTSC() *Steps
- func (steps *Steps) GrayscaleRY() *Steps
- func (steps *Steps) Invert() *Steps
- func (steps *Steps) JPEG(operation ioOperation) *Steps
- func (steps *Steps) PNG(operation ioOperation) *Steps
- func (steps *Steps) Region(region Region) *Steps
- func (steps *Steps) RegionPercentage(region RegionPercentage) *Steps
- func (steps *Steps) Rotate180() *Steps
- func (steps *Steps) Rotate270() *Steps
- func (steps *Steps) Rotate90() *Steps
- func (steps *Steps) Saturation(value float32) *Steps
- func (steps *Steps) Sepia() *Steps
- func (steps *Steps) ToJSON() []byte
- func (steps *Steps) Watermark(data ioOperation, gravity interface{}, fitMode string, fitBox FitBox, ...) *Steps
- func (steps *Steps) WebP(operation ioOperation) *Steps
- func (steps *Steps) WhiteBalanceSRGB(threshold float32) *Steps
- type Transparent
- type URL
- type WebP
- type WebPLossless
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Black ¶
type Black struct{}
Black is the Implementation of interface Color and used as color black
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer is io operation related to []byte
type Color ¶
type Color interface {
// contains filtered or unexported methods
}
Color must be implemented by all the Colors that can be used by imageflow
type Constrain ¶
type Constrain struct { Mode string `json:"mode"` W float64 `json:"w"` H float64 `json:"h"` Hint ConstraintHint `json:"hints"` Gravity interface{} `json:"gravity"` CanvasColor interface{} `json:"canvas_color"` }
Constrain is used to specify constraints for the image W The width constraint in pixels H The height constraint in pixels Mode A constraint mode Gravity determines how the image is anchored when cropped or padded. {x: 0, y: 0} represents top-left, {x: 50, y: 50} represents center, {x:100, y:100} represents bottom-right. Default: center Hints See resampling hints Canvas_color See Color. The color of padding added to the image.
type ConstraintGravity ¶
ConstraintGravity anchors the image
type ConstraintHint ¶
type ConstraintHint struct { SharpenPercent interface{} `json:"sharpen_percent"` DownFilter interface{} `json:"down_filter"` UpFilter interface{} `json:"up_filter"` ScalingColorspace interface{} `json:"scaling_colorspace"` BackgroundColor interface{} `json:"background_color"` ResampleWhen interface{} `json:"resample_when"` SharpenWhen interface{} `json:"sharpen_when"` }
ConstraintHint is used to provided changes when resampling SharpenPercent (0..100) The amount of sharpening to apply during resampling UpFilter The resampling filter to use if upscaling in one or more directions DownFilter The resampling filter to use if downscaling in both directions. ScalingColorspace Use linear for the best results, or srgb to mimick poorly-written software. srgb can destroy image highlights. BackgroundColor The background color to apply. ResampleWhen One of size_differs, size_differs_or_sharpening_requested, or always. SharpenWhen One of downscaling, upscaling, size_differs, or always Supported Filters robidoux_sharp - A sharper version of the above robidoux_fast - A faster, less accurate version of robidoux ginseng - The default and suggested upsampling filter ginseng_sharp lanczos lanczos_sharp lanczos_2 lanczos_2_sharp cubic cubic_sharp catmull_rom mitchell cubic_b_spline hermite jinc triangle linear box fastest n_cubic n_cubic_sharp
type DrawExact ¶
type DrawExact struct { W float32 `json:"w"` H float32 `json:"h"` X float32 `json:"x"` Y float32 `json:"y"` Blend string `json:"blend"` Hints interface{} `json:"hints"` }
DrawExact is used to copy a part of image
type ExpandCanvas ¶
type ExpandCanvas struct { Left float64 `json:"left"` Right float64 `json:"right"` Top float64 `json:"top"` Bottom float64 `json:"bottom"` Color interface{} `json:"color"` }
ExpandCanvas is used to expand the image
type File ¶
type File struct {
// contains filtered or unexported fields
}
File is io operation related to file
type FitBox ¶
type FitBox interface {
// contains filtered or unexported methods
}
FitBox is used to specify image position
type LosslessPNG ¶
type LosslessPNG struct {
MaxDeflate bool `json:"max_deflate"`
}
LosslessPNG is a encoder for lodepng
type LossyPNG ¶
type LossyPNG struct { Quality int `json:"quality"` MinimumQuality int `json:"minimum_quality"` Speed int `json:"speed"` MaximumDeflate bool `json:"maximum_deflate"` }
LossyPNG is used for encoding pngquant
type MarginFitBox ¶
type MarginFitBox struct { Left float64 `json:"left"` Right float64 `json:"right"` Top float64 `json:"top"` Bottom float64 `json:"bottom"` }
MarginFitBox is used to specify image position
type PercentageFitBox ¶
type PercentageFitBox struct { X1 float64 `json:"x1"` Y1 float64 `json:"y1"` X2 float64 `json:"x2"` Y2 float64 `json:"y2"` }
PercentageFitBox is used to specify image position
type RectangleToCanvas ¶
type RectangleToCanvas struct { FromX float32 `json:"from_x"` FromY float32 `json:"from_y"` W float32 `json:"w"` H float32 `json:"h"` X float32 `json:"x"` Y float32 `json:"y"` }
RectangleToCanvas is used to copy a part of image
type Region ¶
type Region struct { X1 float64 `json:"x1"` Y1 float64 `json:"y1"` X2 float64 `json:"x2"` Y2 float64 `json:"y2"` BackgroundColor interface{} `json:"background_color"` }
Region is like a crop command, but you can specify coordinates outside of the image and thereby add padding. It's like a window.
type RegionPercentage ¶
type RegionPercentage struct { X1 float64 `json:"x1"` Y1 float64 `json:"y1"` X2 float64 `json:"x2"` Y2 float64 `json:"y2"` BackgroundColor interface{} `json:"background_color"` }
RegionPercentage is like a crop command, but you can specify coordinates outside of the image and thereby add padding. It's like a window.
type Steps ¶
type Steps struct {
// contains filtered or unexported fields
}
Steps is the builder for creating a operation
func NewStep ¶
func NewStep() Steps
NewStep creates a step that can be used to specify how graph should be processed
func (*Steps) Alpha ¶
Alpha histogram area This command is not recommended as it operates in the sRGB space and does not produce perfect results.
func (*Steps) Brightness ¶
Brightness histogram area This command is not recommended as it operates in the sRGB space and does not produce perfect results.
func (*Steps) ConstrainWithin ¶
ConstrainWithin is used to constraint a image
func (*Steps) ConstrainWithinH ¶
ConstrainWithinH is used to constraint a image
func (*Steps) ConstrainWithinW ¶
ConstrainWithinW is used to constraint a image
func (*Steps) Contrast ¶
Contrast histogram area This command is not recommended as it operates in the sRGB space and does not produce perfect results.
func (*Steps) CopyRectangle ¶
func (steps *Steps) CopyRectangle(f func(steps *Steps), rect RectangleToCanvas) *Steps
CopyRectangle copy a image
func (*Steps) CropWhitespace ¶
CropWhitespace is used to remove whitespace around the image
func (*Steps) ExpandCanvas ¶
func (steps *Steps) ExpandCanvas(canvas ExpandCanvas) *Steps
ExpandCanvas is used create a rectangle on the image
func (*Steps) GrayscaleBT709 ¶
GrayscaleBT709 histogram area This command is not recommended as it operates in the sRGB space and does not produce perfect results.
func (*Steps) GrayscaleFlat ¶
GrayscaleFlat histogram area This command is not recommended as it operates in the sRGB space and does not produce perfect results.
func (*Steps) GrayscaleNTSC ¶
GrayscaleNTSC histogram area This command is not recommended as it operates in the sRGB space and does not produce perfect results.
func (*Steps) GrayscaleRY ¶
GrayscaleRY histogram area This command is not recommended as it operates in the sRGB space and does not produce perfect results.
func (*Steps) Invert ¶
Invert histogram area This command is not recommended as it operates in the sRGB space and does not produce perfect results.
func (*Steps) RegionPercentage ¶
func (steps *Steps) RegionPercentage(region RegionPercentage) *Steps
RegionPercentage is used to crop or add padding to image using percentage
func (*Steps) Saturation ¶
Saturation histogram area This command is not recommended as it operates in the sRGB space and does not produce perfect results.
func (*Steps) Sepia ¶
Sepia histogram area This command is not recommended as it operates in the sRGB space and does not produce perfect results.
func (*Steps) Watermark ¶
func (steps *Steps) Watermark(data ioOperation, gravity interface{}, fitMode string, fitBox FitBox, opacity float32, hint interface{}) *Steps
Watermark is used to watermark a image
func (*Steps) WhiteBalanceSRGB ¶
WhiteBalanceSRGB histogram area This command is not recommended as it operates in the sRGB space and does not produce perfect results.
type Transparent ¶
type Transparent string
Transparent is the Implementation of interface Color and used as color transparent
type URL ¶
type URL struct {
// contains filtered or unexported fields
}
URL is used to make a http request to get file and use it
type WebP ¶
type WebP struct {
Quality int `json:"quality"`
}
WebP is used to encode image using webp encoder
type WebPLossless ¶
type WebPLossless struct{}
WebPLossless is used to encode using webplossless encoder