imageutil

package
v0.3.37 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FlattenPixels

func FlattenPixels(pixels [][]float64, x int, y int) []float64

FlattenPixels function flattens 2d array into 1d array.

func MeanOfPixels

func MeanOfPixels(pixels []float64) float64

MeanOfPixels function returns a mean of pixels.

func MedianOfPixels

func MedianOfPixels(pixels []float64) float64

MedianOfPixels function returns a median value of pixels. It uses quick selection algorithm.

func Rgb2Gray

func Rgb2Gray(colorImg image.Image) [][]float64

Rgb2Gray function converts RGB to a gray scale array.

Types

type HDC

type HDC struct {
	//Bg   image.Image
	Rgba *image.RGBA
}

func (*HDC) DrawText

func (this *HDC) DrawText(pen Pen, text string) bool

图片上画文字

func (*HDC) GetBgSize

func (this *HDC) GetBgSize() (w, h int)

func (*HDC) Save

func (this *HDC) Save(imagePath string) bool

保存图片

func (*HDC) SetBg

func (this *HDC) SetBg(imagePath string) bool

type ImageInfo

type ImageInfo struct {
	Content []byte
	ExtName string
	Height  int
	Width   int
}

func ImageBaseInfo

func ImageBaseInfo(source []byte, quality, width int) (*ImageInfo, error)

func ImageResizeChange

func ImageResizeChange(source []byte, quality, width int) (*ImageInfo, error)

type Pen

type Pen struct {
	FontSize   float64
	Dpi        float64
	Font       *truetype.Font
	StartPoint image.Point
	Color      *image.Uniform
}

func OnGetPen

func OnGetPen(fontPath string, R, G, B, A uint8) (pen Pen, b bool)

获取画笔

Jump to

Keyboard shortcuts

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