imgutils

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CircleMask

func CircleMask(src image.Image) image.Image

CircleMask 从图片中间取圆形遮罩

func CreateWhiteBackground

func CreateWhiteBackground(w int, h int) *image.RGBA

func DrawStringAndSave

func DrawStringAndSave(img image.Image, infos []*TextBrush) (image.Image, error)

func GetBase64FromUrl

func GetBase64FromUrl(url string) (string, error)

func GetFromBase64

func GetFromBase64(base64Img string) (image.Image, error)

GetFromBase64 base64->image.image

func GetFromBytes

func GetFromBytes(imgBytes []byte) (image.Image, error)

GetFromBytes bytes->image.image

func MergeImagesHighLow

func MergeImagesHighLow(highImg image.Image, lowImg image.Image) image.Image

func MiddleCoverCoordinate

func MiddleCoverCoordinate(background image.Image, coverImg image.Image) image.Rectangle

MiddleCoverCoordinate 中间覆盖图片到背景图片坐标计算

func RGBA

func RGBA(img image.Image) *image.RGBA

RGBA RGBA

func ReplaceWechatMiniProgramQrLogo(qr image.Image, logo image.Image) ([]byte, error)

func Resize

func Resize(src image.Image, width, height uint) image.Image

ResizeImg 缩放原始图片 只给width,height,按比例缩放

func TransBackground

func TransBackground(src image.Image) image.Image

Types

type DrawTextInfo

type DrawTextInfo struct {
	Text string
	X    int
	Y    int
}

DrawTextInfo 图片绘字信息

type TextBrush

type TextBrush struct {
	FontType  *truetype.Font
	FontSize  float64
	FontColor *image.Uniform
	TextWidth int
	DrawInfo  *DrawTextInfo
}

TextBrush 字体相关

func NewTextBrush

func NewTextBrush(font *truetype.Font, FontSize float64, FontColor *image.Uniform, textWidth int, drawInfo *DrawTextInfo) (*TextBrush, error)

func (*TextBrush) DrawFontOnRGBA

func (tb *TextBrush) DrawFontOnRGBA(rgba *image.RGBA) error

Jump to

Keyboard shortcuts

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