scaler

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2023 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package scaler provides utilities for scaling images.

Index

Constants

This section is empty.

Variables

View Source
var ErrCancelled = fmt.Errorf("scale operation on cancelled Scaler")

ErrCancelled is returned when one is trying to interact with an stopped scaler.

Functions

This section is empty.

Types

type Result

type Result struct {
	ImgData []byte
	Err     error
}

Result is a type which encapsulates a result from an image conversion.

type Scaler

type Scaler interface {
	// Scale converts the image (img) to have width toWidth in pixels while
	// preserving its aspect ratio.
	Scale(ctx context.Context, img io.Reader, toWidth int) ([]byte, error)

	// Cancel stops the scaler and of its operations. Users may not use
	// any further methods on cancelled scalers.
	Cancel()
}

Scaler is a utility type which could be used for scaling images.

func New

func New(ctx context.Context) Scaler

New returns a new scaler, ready for use.

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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