Documentation
¶
Overview ¶
Package factory provides image manipulation utilities built on top of gg.
factory 包提供基于 gg 的图像操作工具库。
Index ¶
- func GIF2Base64(gifImage *gif.GIF) (string, error)
- func GetPaletted(im image.Image) *image.Paletted
- func Limit(img image.Image, xmax, ymax int) image.Image
- func Load(path string) (img image.Image, err error)
- func MergeGif(delay int, im []*image.NRGBA) *gif.GIF
- func Parse(r io.Reader) (img image.Image, err error)
- func RenderText(text, font string, width, fontSize int) (txtPic image.Image, err error)
- func RenderTextWith(text string, font []byte, width, fontSize int) (txtPic image.Image, err error)
- func ToBase64(img image.Image) (base64Bytes []byte, err error)
- func ToBytes(img image.Image) (data []byte, err error)
- func WriteTo(img image.Image, f io.Writer) (n int64, err error)
- type Factory
- func LoadAllFrames(path string, w, h int) ([]*Factory, error)
- func LoadAllTrueFrames(path string, w, h int) ([]*Factory, error)
- func LoadFirstFrame(path string, w, h int) (*Factory, error)
- func MergeH(im []*image.NRGBA) *Factory
- func MergeW(im []*image.NRGBA) *Factory
- func NewFactory(im *image.NRGBA) *Factory
- func NewFactoryBG(w, h int, fillColor color.Color) *Factory
- func ParseFirstFrame(r io.Reader, w, h int) (*Factory, error)
- func Rotate(img image.Image, angle float64, w, h int) *Factory
- func Size(im image.Image, w, h int) *Factory
- func Text(font string, size float64, col []int, col1 []int, txt string) *Factory
- func (dst *Factory) AdjustBrightness(s float64) *Factory
- func (dst *Factory) AdjustContrast(a float64) *Factory
- func (dst *Factory) AdjustSaturation(a float64) *Factory
- func (dst *Factory) Blur(a float64) *Factory
- func (dst *Factory) Circle(r int) *Factory
- func (dst *Factory) Clip(w, h, x, y int) *Factory
- func (dst *Factory) ClipCircle(x, y, r int) *Factory
- func (dst *Factory) ClipCircleFix(x, y, r int) *Factory
- func (dst *Factory) Clone() *Factory
- func (dst *Factory) FlipH() *Factory
- func (dst *Factory) FlipV() *Factory
- func (dst *Factory) Grayscale() *Factory
- func (dst *Factory) H() int
- func (dst *Factory) Image() *image.NRGBA
- func (dst *Factory) InsertBottom(im image.Image, w, h, x, y int) *Factory
- func (dst *Factory) InsertBottomC(im image.Image, w, h, x, y int) *Factory
- func (dst *Factory) InsertText(font string, size float64, col []int, x, y float64, txt string) *Factory
- func (dst *Factory) InsertUp(im image.Image, w, h, x, y int) *Factory
- func (dst *Factory) InsertUpC(im image.Image, w, h, x, y int) *Factory
- func (dst *Factory) InsertUpG(im []*image.NRGBA, w, h, x, y int) []*image.NRGBA
- func (dst *Factory) Invert() *Factory
- func (dst *Factory) Relief() *Factory
- func (dst *Factory) Reshape(w, h int) *Factory
- func (dst *Factory) Sharpen(a float64) *Factory
- func (dst *Factory) W() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPaletted ¶
GetPaletted 将image.Image转换为 *Paletted。最多256色
func RenderText ¶
RenderText 文字转图片 width 是图片宽度
func RenderTextWith ¶
RenderTextWith 文字转图片 width 是图片宽度
Types ¶
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
Factory 处理中图像
func LoadAllFrames ¶
LoadAllFrames 加载每一帧图片
func LoadAllTrueFrames ¶
LoadAllTrueFrames 加载每一帧显示出的图片
func LoadFirstFrame ¶
LoadFirstFrame 载入图片第一帧作底图
func NewFactory ¶
NewFactory creates a Factory from an existing *image.NRGBA.
NewFactory 从已有的 *image.NRGBA 创建 Factory。
func NewFactoryBG ¶
NewFactoryBG creates a new Factory with a solid background color.
NewFactoryBG 创建一个具有纯色背景的新 Factory。
func ParseFirstFrame ¶
ParseFirstFrame 解析图片第一帧作底图
func (*Factory) AdjustBrightness ¶
AdjustBrightness 亮度(-100, 100)
func (*Factory) AdjustContrast ¶
AdjustContrast 对比度(-100, 100)
func (*Factory) AdjustSaturation ¶
AdjustSaturation 饱和度(-100, 100)
func (*Factory) ClipCircleFix ¶
ClipCircleFix 裁取圆图
func (*Factory) InsertBottom ¶
InsertBottom 底部插入图片
func (*Factory) InsertBottomC ¶
InsertBottomC 底部插入图片 x,y是中心点
func (*Factory) InsertText ¶
func (dst *Factory) InsertText(font string, size float64, col []int, x, y float64, txt string) *Factory
InsertText 插入文本