imageKit

package
v3.0.905 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Decode func(r io.Reader) (image.Image, string, error) = image.Decode

Decode 解码图片

@param r 类型可以是: *os.File(用完记得调用Close())

Functions

func DecodeFromBase64

func DecodeFromBase64(base64 []byte) ([]byte, error)

DecodeFromBase64 图片的base64数据 => 图片的数据(可以直接存储到硬盘上)

@param base64 带不带前缀都无所谓(e.g. "data:image/png;base64,"、"data:image/jpeg;base64,"、"data:image/gif;base64,")

func DecodeToImageFile

func DecodeToImageFile(base64 []byte, dest string, perm os.FileMode) error

DecodeToImageFile

@param target 要生成的图片的路径

func DecodeWithPath

func DecodeWithPath(src string) (image.Image, string, error)

DecodeWithPath 解码图片

func EncodeToBase64String

func EncodeToBase64String(data []byte) (string, error)

func GetImageBase64

func GetImageBase64(imagePath string) (string, error)

GetImageBase64 (硬盘上的)图片 => base64字符串

参考: golang 将图片生成Base64 https://blog.csdn.net/weixin_40292098/article/details/126029489

func GetWebImageBase64

func GetWebImageBase64(url string) (string, error)

GetWebImageBase64 网络图片 => base64字符串

参考: golang 将图片生成Base64 https://blog.csdn.net/weixin_40292098/article/details/126029489

@param url e.g."https://img.redocn.com/sheying/20150507/pugongying_4267498.jpg"

func ToBmp

func ToBmp(src, dest string) error

ToBmp 将图片格式转换为".bmp".

func ToJpeg

func ToJpeg(src, dest string, qualityArgs ...int8) error

ToJpeg 将图片格式转换为".jpg"(||".jpeg").

@param qualityArgs (默认: 100; 取值范围: [1, 100])生成jpeg图片的质量

func ToPng

func ToPng(src, dest string) error

ToPng 将图片格式转换为".png".

func ToTiff

func ToTiff(src, dest string, opts *tiff.Options) error

ToTiff 将图片格式转换为".tiff".

Types

type Info

type Info struct {
	ExtName    string      `json:"extName"`
	ColorModel color.Model `json:"colorModel"`

	Width  int `json:"width"`
	Height int `json:"height"`
}

func GetInfo

func GetInfo(path string) (*Info, error)

GetInfo 获取图片的信息(宽、高、后缀名).

【图像处理】Golang 获取常用图像的宽高总结

https://www.cnblogs.com/voipman/p/16108320.html

Jump to

Keyboard shortcuts

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