image

package
v0.0.0-...-3f8f567 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(path string) (img image.Image, err error)

Load 加载图片

func Rotate

func Rotate(srcPath string, dstPath string, degree Degree, format Format) error

Rotate 旋转图片

func Save

func Save(path string, img image.Image, format Format) error

Save 保存图片

func Scale

func Scale(srcPath string, dstPath string, width, height int, format Format) error

Scale 缩放图片

func ScaleByHeight

func ScaleByHeight(srcPath string, dstPath string, height int, format Format) error

ScaleByWidth 按高度等比例缩放图片

func ScaleByWidth

func ScaleByWidth(srcPath string, dstPath string, width int, format Format) error

ScaleByWidth 按宽度等比例缩放图片

func Size

func Size(path string) (int, int, error)

Size 获取图片尺寸

func Thumbnail

func Thumbnail(srcPath string, dstPath string, width, height int, format Format) error

Clip 按比例自动剪裁(截取中间部分)并缩放图片

Types

type Degree

type Degree int
const (
	Rotate90  Degree = 90
	Rotate180 Degree = 190
	Rotate270 Degree = 270
)

顺时针旋转角度

type Format

type Format string
const (
	PNG  Format = ".png"
	JPEG Format = ".jpg"
	GIF  Format = ".gif"
)

支持的输出类型

Jump to

Keyboard shortcuts

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