Documentation
¶
Overview ¶
Package jpegli implements an JPEG image encoder/decoder based on jpegli compiled to WASM.
Index ¶
- Constants
- Variables
- func Decode(r io.Reader) (image.Image, error)
- func DecodeConfig(r io.Reader) (image.Config, error)
- func DecodeWithOptions(r io.Reader, o *DecodingOptions) (image.Image, error)
- func Encode(w io.Writer, m image.Image, o ...*EncodingOptions) error
- type DCTMethod
- type DecodingOptions
- type EncodingOptions
Constants ¶
View Source
const DefaultDCTMethod = DCTFloat
DefaultDCTMethod is the default DCT algorithm method.
View Source
const DefaultQuality = 90
DefaultQuality is the default quality encoding parameter.
Variables ¶
View Source
var ( ErrMemRead = errors.New("jpegli: mem read failed") ErrMemWrite = errors.New("jpegli: mem write failed") ErrDecode = errors.New("jpegli: decode failed") ErrEncode = errors.New("jpegli: encode failed") )
Errors .
Functions ¶
func DecodeConfig ¶
DecodeConfig returns the color model and dimensions of a JPEG image without decoding the entire image.
func DecodeWithOptions ¶
DecodeWithOptions reads a JPEG image from r with decoding options.
Types ¶
type DecodingOptions ¶
type DecodingOptions struct {
// ScaleTarget is the target size to scale image.
ScaleTarget image.Rectangle
// Fancy upsampling.
FancyUpsampling bool
// Block smoothing.
BlockSmoothing bool
// Use arithmetic coding instead of Huffman.
ArithCode bool
// DCTMethod is DCT Algorithm method.
DCTMethod DCTMethod
}
DecodingOptions are the decoding parameters.
type EncodingOptions ¶
type EncodingOptions struct {
// Quality in the range [0,100]. Default is 75.
Quality int
// Chroma subsampling setting, 444|440|422|420.
ChromaSubsampling image.YCbCrSubsampleRatio
// Progressive level in the range [0,2], where level 0 is sequential, and greater level value means more progression steps.
ProgressiveLevel int
// Huffman code optimization.
// Enabled by default.
OptimizeCoding bool
// Uses adaptive quantization for creating more zero coefficients.
// Enabled by default.
AdaptiveQuantization bool
// Use standard quantization tables from Annex K of the JPEG standard.
// By default, jpegli uses a different set of quantization tables and different scaling parameters for DC and AC coefficients.
StandardQuantTables bool
// Apply fancy downsampling.
FancyDownsampling bool
// DCTMethod is the DCT algorithm method.
DCTMethod DCTMethod
}
EncodingOptions are the encoding parameters.
func EncodeQuality ¶
func EncodeQuality(q int) *EncodingOptions
Click to show internal directories.
Click to hide internal directories.