Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrWebPNotSupported = errors.New("WebP support is not available in this build (requires CGO and libwebp)")
ErrWebPNotSupported is returned when WebP functionality is not available This error is only used in the no-CGO build, but declared here for API consistency
Functions ¶
func CompressJPEG ¶
Обёртка для сжатия файла.
func CompressToWebP ¶ added in v0.2.0
CompressToWebP reads a JPEG and saves it as WebP
Types ¶
type Compressor ¶
type Compressor struct {
// contains filtered or unexported fields
}
func New ¶
func New(quality int) *Compressor
Создаёт Compressor. Качество ограничивается диапазоном 1-100.
func (*Compressor) Compress ¶
func (c *Compressor) Compress(img image.Image) ([]byte, error)
Compress image.Image and return bytes.
func (*Compressor) CompressFile ¶
func (c *Compressor) CompressFile(inputPath, outputPath string) (err error)
CompressFile сжимает JPEG файл.
func (*Compressor) Quality ¶
func (c *Compressor) Quality() int
Click to show internal directories.
Click to hide internal directories.