tools

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

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

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertAndCompressToJPEG

func ConvertAndCompressToJPEG(srcData []byte, quality int) ([]byte, error)

func ConvertToPNG

func ConvertToPNG(srcData []byte) ([]byte, error)

func FullURL

func FullURL(baseURL, path string) string

func GetOnlineImage

func GetOnlineImage(url string) (bytes []byte, fName string, err error)

func PanicOnError

func PanicOnError[T any](v T, e error) T

func ReadFile

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

func Thumbnail

func Thumbnail(r io.Reader, ratio float64, format imaging.Format) (io.Reader, error)

Types

type ImageType

type ImageType string
const (
	ImageTypeJPEG    ImageType = "jpeg"
	ImageTypePNG     ImageType = "png"
	ImageTypeGIF     ImageType = "gif"
	ImageTypeWEBP    ImageType = "webp"
	ImageTypeHEIC    ImageType = "heic"
	ImageTypeUnknown ImageType = "unknown"
)

func DetectImageType

func DetectImageType(data []byte) ImageType

func (ImageType) ImagingFormat

func (i ImageType) ImagingFormat() (imaging.Format, error)

func (ImageType) String

func (i ImageType) String() string

Jump to

Keyboard shortcuts

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