image

package
v0.0.0-...-6af97ad Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ExtNotSupportError = errors.New("ext of filename not support")
	FileNameError      = errors.New("filename error")
	FileExistError     = errors.New("File already exist error")
)

Functions

func ChangeImageName

func ChangeImageName(oldname string, newname string, force bool) (err error)

文件改名,如果force为假,且新的文件名已经存在,那么抛出错误 change a file's name,if force is False then if exist file thorw FileExistError

func LoadImage

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

根据文件名打开图片,并编码,返回编码对象和文件类型 Load a image by a filename and return it's type,such as png

func RealImageName

func RealImageName(filename string) (filerealname string, err error)

图像文件的真正名字 a image file real filename ,such as a tt.jpg may be a tt.png

func SaveImage

func SaveImage(path string, img *image.RGBA, filetype string) (err error)

将编码对象存入文件中 save a image object into a file just support png and jpg

func Scale

func Scale(filename string, newdx int) (dst *image.RGBA, filetype string, err error)

对文件中的图片进行等比例变化,宽度为newdx,返回图像编码和文件类型 see ScaleF2F

func ScaleF2F

func ScaleF2F(filename string, savepath string, width int) (err error)

按宽度进行比例缩放 just scale by width from a image file to other file ,maybe ugly

func ThumbnailF2F

func ThumbnailF2F(filename string, savepath string, width int, height int) (err error)

按宽度和高度进行比例缩放 scale by width and height from a image file to aother file

Types

This section is empty.

Jump to

Keyboard shortcuts

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