resize

package module
v0.0.0-...-fae5189 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2018 License: MIT Imports: 5 Imported by: 0

README

resize

Documentation

Overview

================================= * Copyright(c)2015-2016 govenue * From: github.com/nfnt/resize *=================================

================================= * Copyright(c)2015-2016 govenue * From: github.com/nfnt/resize *=================================

================================= * Copyright(c)2015-2016 govenue * From: github.com/nfnt/resize *=================================

================================= * Copyright(c)2015-2016 govenue * From: github.com/nfnt/resize *=================================

================================= * Copyright(c)2015-2016 govenue * From: github.com/nfnt/resize *=================================

================================= * Copyright(c)2015-2016 govenue * From: github.com/nfnt/resize *=================================

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Resize

func Resize(width, height uint, img image.Image, interp InterpolationFunction) image.Image

Resize scales an image to new width and height using the interpolation function interp. A new image with the given dimensions will be returned. If one of the parameters width or height is set to 0, its size will be calculated so that the aspect ratio is that of the originating image. The resizing algorithm uses channels for parallel computation.

func Thumbnail

func Thumbnail(maxWidth, maxHeight uint, img image.Image, interp InterpolationFunction) image.Image

Thumbnail will downscale provided image to max width and height preserving original aspect ratio and using the interpolation function interp. It will return original image, without processing it, if original sizes are already smaller than provided constraints.

Types

type InterpolationFunction

type InterpolationFunction int

An InterpolationFunction provides the parameters that describe an interpolation kernel. It returns the number of samples to take and the kernel function to use for sampling.

const (
	// Nearest-neighbor interpolation
	NearestNeighbor InterpolationFunction = iota
	// Bilinear interpolation
	Bilinear
	// Bicubic interpolation (with cubic hermite spline)
	Bicubic
	// Mitchell-Netravali interpolation
	MitchellNetravali
	// Lanczos interpolation (a=2)
	Lanczos2
	// Lanczos interpolation (a=3)
	Lanczos3
)

InterpolationFunction constants

Jump to

Keyboard shortcuts

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