Documentation
¶
Index ¶
- Constants
- func Bounds(m image.Image) (int, int)
- func Clip(target image.Image, x0, y0, width, height int) image.Image
- func ClipImage(target image.Image, x0, y0, width, height int) image.Image
- func ClipPNG(target image.Image, x0, y0, width, height int) image.Image
- func ClipQuad(target image.Image) (image.Image, image.Image, image.Image, image.Image)
- func ConvertJPEGToTransparentPNG(inputPath, outputPath string, bgColor color.RGBA, tolerance uint8) error
- func Copy(src image.Image) draw.Image
- func EachColor(m image.Image, callback func(color.Color, int, int))
- func Edge(img image.Image) *image.RGBA
- func MaskImage(src, mask image.Image, copyPoint image.Point) (draw.Image, error)
- func MergeTileImage(source image.Image, source2 image.Image) image.Image
- func PieceImage(src, mask image.Image, copyPoint image.Point) (draw.Image, error)
- func Resize(target image.Image, width, height int) image.Image
- func Rotate(target image.Image, angle float64) image.Image
- func Rotate90(target image.Image) image.Image
- func Rotate270(target image.Image) image.Image
- func SaveAsGIF(target image.Image, path string) error
- func SaveAsJPEG(target image.Image, path string) error
- func SaveAsPNG(target image.Image, path string) error
- func SaveBase64(source string, path string) (err error)
- func SetColorTransparent(source image.Image, c color.RGBA) image.Image
- func SetColorTransparentWithBlack(source image.Image) image.Image
- func Thumbnail(target image.Image, maxWidth, maxHeight int) image.Image
- func ToBase64(target image.Image, imageType string) (data string, err error)
- func ToBytes(target image.Image, imageType string) (bs []byte, err error)
- func ToDataURI(target image.Image, imageType string) (data string, err error)
- func ToJpegBytes(target image.Image, options *jpeg.Options) (bs []byte, err error)
- type Img
- func (m *Img) Clip(x0, y0, width, height int) *Img
- func (m *Img) ClipPNG(x0, y0, width, height int) *Img
- func (m *Img) EachColor(callback func(color.Color, int, int))
- func (p *Img) MustToBase64() (data string)
- func (m *Img) MustToBytes(format string) []byte
- func (p *Img) MustToDataURI() (data string)
- func (p *Img) Resize(width, height int) *Img
- func (p *Img) Rotate(angle float64) *Img
- func (p *Img) Rotate90() *Img
- func (p *Img) Rotate270() *Img
- func (p *Img) Save(path string, format string) error
- func (p *Img) Thumbnail(width, height int) *Img
- func (p *Img) ToBase64() (data string, err error)
- func (m *Img) ToBytes() (bs []byte, err error)
- func (p *Img) ToDataURI() (data string, err error)
- func (m *Img) ToPngBytes() (bs []byte, err error)
Constants ¶
View Source
const ( JPG = "jpg" JPEG = "jpeg" PNG = "png" GIF = "gif" BMP = "bmp" TIF = "tif" WEBP = "webp" )
Variables ¶
This section is empty.
Functions ¶
func ConvertJPEGToTransparentPNG ¶ added in v1.2.0
func ConvertJPEGToTransparentPNG(inputPath, outputPath string, bgColor color.RGBA, tolerance uint8) error
ConvertJPEGToTransparentPNG 将指定背景色的JPEG转换为透明PNG 参考 img.SetColorTransparent 参数:
inputPath: 输入JPEG文件路径 outputPath: 输出PNG文件路径 bgColor: 目标背景色(RGBA格式) tolerance: 颜色容差值(0-255)
返回值:
error: 操作过程中发生的错误
func MergeTileImage ¶ added in v1.2.0
MergeTileImage 用于合并有黑色背景的mbtiles的图片
func PieceImage ¶
PieceImage 获取蒙版遮罩本身的空白区域(裁剪下来的区域)
func SetColorTransparent ¶ added in v1.2.0
SetColorTransparent c 一般为黑色背景的RGB值
func SetColorTransparentWithBlack ¶ added in v1.2.0
SetColorTransparentWithBlack
Types ¶
type Img ¶
func (*Img) MustToBase64 ¶
func (*Img) MustToBytes ¶ added in v1.2.0
MustToBytes
func (*Img) MustToDataURI ¶
func (*Img) ToPngBytes ¶ added in v1.2.0
Click to show internal directories.
Click to hide internal directories.