image

package
v0.0.0-...-43f4138 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2017 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Copyright 2017 by GoSpider author. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

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