img

package
v0.0.0-...-b518f07 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2023 License: GPL-3.0 Imports: 12 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

Overview

Package img gg 的简易封装

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 Limit

func Limit(img image.Image, xmax, ymax int) image.Image

Limit 限制图片在 xmax*ymax 之内

func Load

func Load(path string) (img image.Image, err error)

Load 加载图片

func LoadAllFrames

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

LoadAllFrames 加载图片每一帧图片

func MergeGif

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

MergeGif 合并成gif,1 dealy 10毫秒

Types

type Factory

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

Factory 处理中图像

func LoadFirstFrame

func LoadFirstFrame(path string, w, h int) (*Factory, error)

LoadFirstFrame 载入图片第一帧作底图

func MergeH

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

MergeH 纵向合并图片

func MergeW

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

MergeW 横向合并图片

func NewFactory

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

NewFactory 设置底图

func Rotate

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

Rotate 旋转

func Size

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

Size 变形

func Text

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

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

func (*Factory) AdjustBrightness

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

AdjustBrightness 亮度(-100, 100)

func (*Factory) AdjustContrast

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

AdjustContrast 对比度(-100, 100)

func (*Factory) AdjustSaturation

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

AdjustSaturation 饱和度(-100, 100)

func (*Factory) Blur

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

Blur 模糊图像 正数

func (*Factory) Circle

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

Circle 获取圆图

func (*Factory) Clip

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

Clip 剪取方图

func (*Factory) ClipCircle

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

ClipCircle 扣取圆

func (*Factory) ClipCircleFix

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

ClipCircleFix 裁取圆图

func (*Factory) Clone

func (dst *Factory) Clone() *Factory

Clone 克隆

func (*Factory) Convolve3x3

func (dst *Factory) Convolve3x3() *Factory

Convolve3x3 浮雕

func (*Factory) FlipH

func (dst *Factory) FlipH() *Factory

FlipH 水平翻转

func (*Factory) FlipV

func (dst *Factory) FlipV() *Factory

FlipV 垂直翻转

func (*Factory) Grayscale

func (dst *Factory) Grayscale() *Factory

Grayscale 灰度

func (*Factory) InsertBottom

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

InsertBottom 底部插入图片

func (*Factory) InsertBottomC

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

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

func (*Factory) InsertText

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

InsertText 插入文本

func (*Factory) InsertUp

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

InsertUp 上部插入图片

func (*Factory) InsertUpC

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

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

func (*Factory) InsertUpG

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

InsertUpG gif 上部插入图片

func (*Factory) Invert

func (dst *Factory) Invert() *Factory

Invert 反色

func (*Factory) Reshape

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

Reshape 变形

func (*Factory) Sharpen

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

Sharpen 锐化

Directories

Path Synopsis
Package pool 图片缓存池
Package pool 图片缓存池
Package text 文字转图片
Package text 文字转图片

Jump to

Keyboard shortcuts

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