imgo

package module
v0.40.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2023 License: Apache-2.0 Imports: 14 Imported by: 32

README

img

CircleCI Status codecov Build Status Go Report Card GoDoc Release

Documentation

Overview

Package imgo process the image and get info

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteToImg added in v0.20.0

func ByteToImg(b []byte) (image.Image, error)

ByteToImg convert []byte to image.Image

func ConvertToRGBA added in v0.30.0

func ConvertToRGBA(img image.Image) (r *image.RGBA)

ConvertToRGBA convert the image.Image to *image.RGBA

func Create added in v0.30.0

func Create(path string) (*os.File, error)

Create create a file by path

func Decode added in v0.30.0

func Decode(f *os.File, fm string) (image.Image, error)

Decode decode image from file

func DecodeFile

func DecodeFile(fileName string) (image.Image, string, error)

DecodeFile decodes image file

func Destroy

func Destroy(filePath string) error

Destroy destroy the file

func Encode

func Encode(out io.Writer, subImg image.Image, fm string, quality ...int) error

Encode encode image to buf

func EncodeImg added in v0.20.0

func EncodeImg(m image.Image) (pix []uint8, stride int, err error)

EncodeImg encode the image.Image return pix and stride

func GetSize

func GetSize(imagePath string) (int, int, error)

GetSize get the image's size

func Height added in v0.30.0

func Height(img image.Image) int

Height return the image.Image height

func ImgToBytes

func ImgToBytes(path string) ([]byte, error)

ImgToBytes trans image to []byte

func IsBlack

func IsBlack(c color.Color) bool

IsBlack color is black

func ModTime

func ModTime(filePath string) (int64, error)

ModTime file modified time

func OpenBase64 added in v0.30.0

func OpenBase64(file string) (encode string, err error)

OpenBase64 return a base64 string from image file

func PngToBytes

func PngToBytes(path string) ([]byte, error)

PngToBytes trans png to []byte

func Read added in v0.30.0

func Read(path string) (image.Image, error)

Read read the file return image.Image

func ReadPNG

func ReadPNG(path string) (image.Image, error)

ReadPNG read png return image.Image

func Rename

func Rename(filePath, to string) error

Rename rename file name

func Save

func Save(path string, img image.Image, quality ...int) error

Save create a image file with the image.Image

func SaveByBase64 added in v0.30.0

func SaveByBase64(encode string, path string) error

SaveByBase64 create a image file from base64 string

func SaveByte added in v0.30.0

func SaveByte(path string, dist []byte) error

SaveByte []byte to image path

func SaveToJpeg added in v0.11.0

func SaveToJpeg(path string, img image.Image, quality ...int) error

SaveToJpeg create a jpeg file with the image.Image

func SaveToPNG

func SaveToPNG(path string, img image.Image) error

SaveToPNG create a png file with the image.Image

func StrToImg added in v0.20.0

func StrToImg(data string) (image.Image, error)

StrToImg convert base64 string to image.Image

func ToByte added in v0.40.0

func ToByte(img image.Image, fm ...string) []byte

ToByte convert image.Image to []byte

func ToBytes

func ToBytes(img image.Image, fm string) ([]byte, error)

ToBytes trans image.Image to []byte

func ToBytesPng

func ToBytesPng(img image.Image) ([]byte, error)

ToBytesPng trans image.Image to []byte

func ToString

func ToString(img image.Image, fm ...string) string

ToString convert image.Image to string

func ToStringImg added in v0.20.0

func ToStringImg(img image.Image) (result string)

ToStringImg tostring image.Image

func Width added in v0.30.0

func Width(img image.Image) int

Width return the image.Image width

Types

This section is empty.

Jump to

Keyboard shortcuts

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