img

package
v1.2.5-beta1 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2022 License: GPL-3.0 Imports: 15 Imported by: 0

README

imgfactory

API 详见代码

处理中图像
type ImgFactory struct {
	Im *image.NRGBA
	W  int
	H  int
}
加载图片
func Load(path string) image.Image
载入图片第一帧作底图
func LoadFirstFrame(path string, w, h int) *ImgFactory
加载图片每一帧图片
func LoadAllFrames(path string, w, h int) []*image.NRGBA

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	White   = []int{255, 255, 255, 255}
	Black   = []int{0, 0, 0, 255}
	Red     = []int{255, 0, 0, 255}
	Green   = []int{0, 255, 0, 255}
	Blue    = []int{0, 0, 255, 255}
	Yellow  = []int{255, 255, 0, 255}
	Cyan    = []int{0, 255, 255, 255}
	Magenta = []int{255, 0, 255, 255}
	Grey    = []int{190, 190, 190, 255}
	Pink    = []int{255, 181, 197, 255}
	Orange  = []int{255, 165, 0, 255}
	TouM    = []int{0, 0, 0, 0}
)

颜色

Functions

func GetPaletted

func GetPaletted(im image.Image) *image.Paletted

GetPaletted 将image.Image转换为 *Paletted。最多256色

func Load

func Load(path string) image.Image

加载图片

func LoadAllFrames

func LoadAllFrames(path string, w, h int) []*image.NRGBA

加载图片每一帧图片

func MergeGif

func MergeGif(delay int, im []*image.NRGBA) *gif.GIF

MergeGif 合并成gif,1 dealy 10毫秒

func SaveGif

func SaveGif(g *gif.GIF, path string) error

SaveGif 保存gif

func SavePng

func SavePng(im image.Image, path string) error

保存png

Types

type ImgFactory

type ImgFactory struct {
	Im *image.NRGBA
	W  int
	H  int
}

处理中图像

func LoadFirstFrame

func LoadFirstFrame(path string, w, h int) *ImgFactory

载入图片第一帧作底图

func MergeH

func MergeH(im []*image.NRGBA) *ImgFactory

纵向合并图片

func MergeW

func MergeW(im []*image.NRGBA) *ImgFactory

横向合并图片

func NewFactory

func NewFactory(w, h int, fillColor color.Color) *ImgFactory

设置底图

func Rotate

func Rotate(img image.Image, angle float64, w, h int) *ImgFactory

旋转

func Size

func Size(im image.Image, w, h int) *ImgFactory

变形

func Text

func Text(font string, size float64, col []int, col1 []int, txt string) *ImgFactory

文本框 字体,大小,颜色 ,背景色,文本

func (*ImgFactory) AdjustBrightness

func (dst *ImgFactory) AdjustBrightness(s float64) *ImgFactory

AdjustBrightness 亮度(-100, 100)

func (*ImgFactory) AdjustContrast

func (dst *ImgFactory) AdjustContrast(a float64) *ImgFactory

AdjustContrast 对比度(-100, 100)

func (*ImgFactory) AdjustSaturation

func (dst *ImgFactory) AdjustSaturation(a float64) *ImgFactory

AdjustSaturation 饱和度(-100, 100)

func (*ImgFactory) Blur

func (dst *ImgFactory) Blur(a float64) *ImgFactory

Blur 模糊图像 正数

func (*ImgFactory) Circle

func (dst *ImgFactory) Circle(r int) *ImgFactory

Circle 获取圆图

func (*ImgFactory) Clip

func (dst *ImgFactory) Clip(w, h, x, y int) *ImgFactory

Clip 剪取方图

func (*ImgFactory) ClipCircle

func (dst *ImgFactory) ClipCircle(x, y, r int) *ImgFactory

ClipCircle 扣取圆

func (*ImgFactory) ClipCircleFix

func (dst *ImgFactory) ClipCircleFix(x, y, r int) *ImgFactory

ClipCircleFix 裁取圆图

func (*ImgFactory) Clone

func (dst *ImgFactory) Clone() *ImgFactory

Clone 克隆

func (*ImgFactory) Convolve3x3

func (dst *ImgFactory) Convolve3x3() *ImgFactory

Convolve3x3 浮雕

func (*ImgFactory) FlipH

func (dst *ImgFactory) FlipH() *ImgFactory

FlipH 水平翻转

func (*ImgFactory) FlipV

func (dst *ImgFactory) FlipV() *ImgFactory

FlipV 垂直翻转

func (*ImgFactory) Grayscale

func (dst *ImgFactory) Grayscale() *ImgFactory

Grayscale 灰度

func (*ImgFactory) InsertBottom

func (dst *ImgFactory) InsertBottom(im image.Image, w, h, x, y int) *ImgFactory

InsertBottom 底部插入图片

func (*ImgFactory) InsertBottomC

func (dst *ImgFactory) InsertBottomC(im image.Image, w, h, x, y int) *ImgFactory

InsertBottomC 底部插入图片 x,y是中心点

func (*ImgFactory) InsertText

func (dst *ImgFactory) InsertText(font string, size float64, col []int, x, y float64, txt string) *ImgFactory

InsertText 插入文本

func (*ImgFactory) InsertUp

func (dst *ImgFactory) InsertUp(im image.Image, w, h, x, y int) *ImgFactory

InsertUp 上部插入图片

func (*ImgFactory) InsertUpC

func (dst *ImgFactory) InsertUpC(im image.Image, w, h, x, y int) *ImgFactory

InsertUpC 上部插入图片 x,y是中心点

func (*ImgFactory) InsertUpG

func (dst *ImgFactory) InsertUpG(im []*image.NRGBA, w, h, x, y int) []*image.NRGBA

InsertUpG gif 上部插入图片

func (*ImgFactory) Invert

func (dst *ImgFactory) Invert() *ImgFactory

Invert 反色

func (*ImgFactory) Reshape

func (dst *ImgFactory) Reshape(w, h int) *ImgFactory

Reshape 变形

func (*ImgFactory) Sharpen

func (dst *ImgFactory) Sharpen(a float64) *ImgFactory

Sharpen 锐化

Jump to

Keyboard shortcuts

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