scaler

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2021 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package scaler provides utilities for scaling images.

Index

Constants

This section is empty.

Variables

This section is empty.

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 struct {
	// contains filtered or unexported fields
}

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.

func (*Scaler) Cancel

func (s *Scaler) Cancel()

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

func (*Scaler) Scale

func (s *Scaler) Scale(
	ctx context.Context,
	img io.Reader,
	toWidth int,
) ([]byte, error)

Scale converts the image (img) to have width toWidth in pixels while preserving its aspect ratio.

Jump to

Keyboard shortcuts

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