jpeg

package
v0.0.0-...-add2d34 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2018 License: GPL-3.0, BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package jpeg decodes JPEG image to image.YCbCr using libjpeg (or libjpeg-turbo).

Index

Constants

View Source
const (
	Y  = 0
	Cb = 1
	Cr = 2
)

Y/Cb/Cr Planes

Variables

View Source
var ErrBadColorspace = errors.New("Image has unsupported colorspace")

Functions

func Decode

func Decode(r io.Reader, options *DecoderOptions) (dest ffmpeg.Frame, err error)

Decode reads a JPEG data stream from r and returns decoded image as an image.Image. Output image has YCbCr colors or 8bit Grayscale.

func DecodeConfig

func DecodeConfig(r io.Reader) (config image.Config, err error)

DecodeConfig returns the color model and dimensions of a JPEG image without decoding the entire image.

func DestinationManagerMapLen

func DestinationManagerMapLen() int

DestinationManagerMapLen returns the number of globally working destinationManagers for debug.

func Encode

func Encode(w io.Writer, src image.Image, opt *EncoderOptions) (err error)

Encode encodes src image and writes into w as JPEG format data.

func SourceManagerMapLen

func SourceManagerMapLen() int

SourceManagerMapLen returns the number of globally working sourceManagers for debug.

func SupportRGBA

func SupportRGBA() bool

SupportRGBA returns whether RGBA decoding is supported.

Types

type DCTMethod

type DCTMethod C.J_DCT_METHOD

DCTMethod is the DCT/IDCT method type.

const (
	// DCTISlow is slow but accurate integer algorithm
	DCTISlow DCTMethod = C.JDCT_ISLOW
	// DCTIFast is faster, less accurate integer method
	DCTIFast DCTMethod = C.JDCT_IFAST
	// DCTFloat is floating-point: accurate, fast on fast HW
	DCTFloat DCTMethod = C.JDCT_FLOAT
)

type DecoderOptions

type DecoderOptions struct {
	ScaleTarget            image.Rectangle // ScaleTarget is the target size to scale image.
	DCTMethod              DCTMethod       // DCTMethod is DCT Algorithm method.
	DisableFancyUpsampling bool            // If true, disable fancy upsampling
	DisableBlockSmoothing  bool            // If true, disable block smoothing
}

DecoderOptions specifies JPEG decoding parameters.

type EncoderOptions

type EncoderOptions struct {
	Quality        int
	OptimizeCoding bool
	DCTMethod      DCTMethod
}

EncoderOptions specifies which settings to use during Compression.

Jump to

Keyboard shortcuts

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