Documentation ¶
Overview ¶
Package resize implements various image resizing methods.
The package works with the Image interface described in the image package. Various interpolation methods are provided and multiple processors may be utilized in the computations.
Example:
imgResized := resize.Resize(1000, 0, imgOld, resize.MitchellNetravali)
Index ¶
- func Resize(width, height uint, img image.Image, interp InterpolationFunction) image.Image
- func Sinc(x float64) float64
- func Sinc1(x float64) (y float64)
- type Filter
- func Bicubic(img image.Image, factor [2]float32) Filter
- func Bilinear(img image.Image, factor [2]float32) Filter
- func Lanczos2(img image.Image, factor [2]float32) Filter
- func Lanczos2Lut(img image.Image, factor [2]float32) Filter
- func Lanczos3(img image.Image, factor [2]float32) Filter
- func Lanczos3Lut(img image.Image, factor [2]float32) Filter
- func MitchellNetravali(img image.Image, factor [2]float32) Filter
- func NearestNeighbor(img image.Image, factor [2]float32) Filter
- type InterpolationFunction
- type Trans2
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Resize ¶
Resize 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.
Types ¶
type Filter ¶
Filter can interpolate at points (x,y)
func Lanczos2Lut ¶
Lanczos interpolation (a=2) using a look-up table to speed up computation
func Lanczos3Lut ¶
Lanczos interpolation (a=3) using a look-up table to speed up computation
func MitchellNetravali ¶
Mitchell-Netravali interpolation
type InterpolationFunction ¶
InterpolationFunction return a Filter implementation that operates on an image. Two factors allow to scale the filter kernels in x- and y-direction to prevent moire patterns.