imgutils

package
v1.1.4-alpha6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CircleImage

func CircleImage(src image.Image) image.Image

CircleImage 从图片中间取圆形遮罩

func CreateWhiteBackgroundImg

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

func DrawStringOnImageAndSave

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

func GetImageFromBase64

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

GetImageFromBase64 base64->image.image

func GetImageFromBytes

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

GetImageFromBytes bytes->image.image

func GetUrlBase64

func GetUrlBase64(url string) (string, error)

func Image2RGBA

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

Image2RGBA Image2RGBA

func MergeImagesHighLow

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

func MiddleCoverCoordinate

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

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

func ResizeImg

func ResizeImg(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