Documentation
¶
Overview ¶
Package pngscaled implements a PNG image decoder that decodes and scale down image at same time.
The PNG specification is at https://www.w3.org/TR/PNG/.
Index ¶
- func Decode(r io.Reader, targetWidth, targetHeight int, filter ResampleFilter) (image.Image, error)
- func VerticalGray16InPlaceQ15(img *image.Gray16, dstH int, f ResampleFilter)
- func VerticalGrayInPlaceQ15(img *image.Gray, dstH int, f ResampleFilter)
- func VerticalNRGBA64InPlaceQ15(img *image.NRGBA64, dstH int, f ResampleFilter)
- func VerticalNRGBAInPlaceQ15(img *image.NRGBA, dstH int, f ResampleFilter)
- func VerticalRGBA64InPlaceQ15(img *image.RGBA64, dstH int, f ResampleFilter)
- func VerticalRGBAInPlaceQ15(img *image.RGBA, dstH int, f ResampleFilter)
- type Config
- type FormatError
- type ResampleFilter
- type UnsupportedError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Decode ¶
Decode reads a PNG image from r and returns it as an image.Image. If targetWidth/targetHeight are > 0, the decoder may scale while decoding. MVP: only 8-bit decode paths (cbTC8 / cbTCA8 / cbG8) are supported here. Pass filter for resampling (e.g. ImagingFilter(Lanczos.Support, Lanczos.Kernel)).
func VerticalGray16InPlaceQ15 ¶
func VerticalGray16InPlaceQ15(img *image.Gray16, dstH int, f ResampleFilter)
func VerticalGrayInPlaceQ15 ¶
func VerticalGrayInPlaceQ15(img *image.Gray, dstH int, f ResampleFilter)
Gray (8-bit)
func VerticalNRGBA64InPlaceQ15 ¶
func VerticalNRGBA64InPlaceQ15(img *image.NRGBA64, dstH int, f ResampleFilter)
func VerticalNRGBAInPlaceQ15 ¶
func VerticalNRGBAInPlaceQ15(img *image.NRGBA, dstH int, f ResampleFilter)
NRGBA (straight alpha — uses premultiplied accumulation to avoid dark halos)
func VerticalRGBA64InPlaceQ15 ¶
func VerticalRGBA64InPlaceQ15(img *image.RGBA64, dstH int, f ResampleFilter)
func VerticalRGBAInPlaceQ15 ¶
func VerticalRGBAInPlaceQ15(img *image.RGBA, dstH int, f ResampleFilter)
RGBA (straight alpha)
Types ¶
type FormatError ¶
type FormatError string
A FormatError reports that the input is not a valid PNG.
func (FormatError) Error ¶
func (e FormatError) Error() string
type ResampleFilter ¶
ResampleFilter specifies a resampling filter to be used for image resizing.
General filter recommendations: - Lanczos A high-quality resampling filter for photographic images yielding sharp results. - CatmullRom A sharp cubic filter that is faster than Lanczos filter while providing similar results. - MitchellNetravali A cubic filter that produces smoother results with less ringing artifacts than CatmullRom. - Linear Bilinear resampling filter, produces a smooth output. Faster than cubic filters. - Box Simple and fast averaging filter appropriate for downscaling. When upscaling it's similar to NearestNeighbor. - NearestNeighbor Fastest resampling filter, no antialiasing.
var BSpline ResampleFilter
BSpline is a smooth cubic filter (BC-spline; B=1; C=0).
var Bartlett ResampleFilter
Bartlett is a Bartlett-windowed sinc filter (3 lobes).
var Blackman ResampleFilter
Blackman is a Blackman-windowed sinc filter (3 lobes).
var Box ResampleFilter
Box filter (averaging pixels).
var CatmullRom ResampleFilter
CatmullRom is a Catmull-Rom - sharp cubic filter (BC-spline; B=0; C=0.5).
var Cosine ResampleFilter
Cosine is a Cosine-windowed sinc filter (3 lobes).
var Gaussian ResampleFilter
Gaussian is a Gaussian blurring filter.
var Hamming ResampleFilter
Hamming is a Hamming-windowed sinc filter (3 lobes).
var Hann ResampleFilter
Hann is a Hann-windowed sinc filter (3 lobes).
var Hermite ResampleFilter
Hermite cubic spline filter (BC-spline; B=0; C=0).
var Lanczos ResampleFilter
Lanczos filter (3 lobes).
var Linear ResampleFilter
Linear filter.
var MitchellNetravali ResampleFilter
MitchellNetravali is Mitchell-Netravali cubic filter (BC-spline; B=1/3; C=1/3).
var Welch ResampleFilter
Welch is a Welch-windowed sinc filter (parabolic window, 3 lobes).
type UnsupportedError ¶
type UnsupportedError string
An UnsupportedError reports that the input uses a valid but unimplemented PNG feature.
func (UnsupportedError) Error ¶
func (e UnsupportedError) Error() string
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
shrink-samples
command
shrink-samples decodes PNG files and writes scaled-down versions to an output directory for visual inspection.
|
shrink-samples decodes PNG files and writes scaled-down versions to an output directory for visual inspection. |