ximg

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2022 License: MulanPSL-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DirectResize     uint8 // 直接压缩
	EqualRatioResize       // 等比压缩
)

Variables

This section is empty.

Functions

func Bmp

func Bmp(dest *os.File, src *os.File, fn ...ToImgFn) error

Bmp

func GetSize

func GetSize(path string) (int64, error)

GetSize 获取文件大小

func Gif

func Gif(dest *os.File, src *os.File, opt *gif.Options, fn ...ToImgFn) error

Gif

func Jpeg

func Jpeg(dest *os.File, src *os.File, quality int, fn ...ToImgFn) error

Jpeg 处理 jpg, jpeg

func Png

func Png(dest *os.File, src *os.File, fn ...ToImgFn) error

Png

func Webp

func Webp(dest *os.File, src *os.File, fn ...ToImgFn) error

Types

type ToImgFn

type ToImgFn func(image.Image) image.Image

ToImgFn 图片处理

type XImg

type XImg struct {
	SysSplit string // 系统路径分隔符
	Path     string // src path
	FileName string // 文件名
	// contains filtered or unexported fields
}

func NewXImg

func NewXImg(src interface{}) *XImg

NewXImg 初始化

func (*XImg) Compress

func (x *XImg) Compress(dest string) (destFileName string, err error)

Compress 压缩图片

func (*XImg) GetImgFmt

func (x *XImg) GetImgFmt() string

GetImgFmt 获取文件格式

func (*XImg) Resize

func (x *XImg) Resize(dest string, newW, newH uint, quality int, resizeType ...uint8) (destFileName string, err error)

Resize 修改尺寸

Jump to

Keyboard shortcuts

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