Documentation
¶
Overview ¶
Package ximage 图片处理、图像字体、验证码
Index ¶
- func CanvasScale(width int, height int, scale float64) (int, int)
- func DrawLine(img SetAble, start image.Point, end image.Point, c color.Color)
- func DrawRandomLine(img *image.RGBA)
- func EncodeEmbed(img image.Image) (string, error)
- func Load(fp string) (image.Image, error)
- func RandomColor() color.RGBA
- func RandomPoint(size image.Point) image.Point
- func RegisterDecoder(ext string, fn DecoderFunc)
- func Resize(src *image.RGBA, width, height int) *image.RGBA
- func ToGrayColor(c color.Color) color.Gray
- func ToGrayImage(img image.Image) *image.Gray
- type DecoderFunc
- type SetAble
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanvasScale ¶
CanvasScale 将宽高调整为指定的比例,在调整时,会保持其中一条边的值不变,让另一条表按照比例放大
func DrawRandomLine ¶
func Load ¶
Load 加载图片文件,并依据文件后缀自动选用合适的解析器解析图片
默认支持:.png、.jpeg、.jpg、.gif 其他后缀可以通过 RegisterDecoder 方法注册实现支持
func RandomColor ¶
func RegisterDecoder ¶
func RegisterDecoder(ext string, fn DecoderFunc)
RegisterDecoder 注册新的解析解析方法 ext: 文件后缀,如 .bmp
Types ¶
type DecoderFunc ¶
func GetDecoderFuncByExt ¶
func GetDecoderFuncByExt(ext string) (DecoderFunc, error)
GetDecoderFuncByExt 获取已注册的好默认内置支持的 DecoderFunc
Click to show internal directories.
Click to hide internal directories.