imgsz

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2022 License: GPL-3.0 Imports: 11 Imported by: 27

README

imgsz

Image size analyzer for jpg/png/gif/webp

Usage

// DecodeSize decodes the dimensions of an image that has
// been encoded in a registered format. The string returned is the format name
// used during format registration. Format registration is typically done by
// an init function in the codec-specific package.
func DecodeSize(r io.Reader) (Size, string, error)

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrFormat = errors.New("image: unknown format")

ErrFormat indicates that decoding encountered an unknown format.

Functions

func RegisterFormat

func RegisterFormat(name, magic string, decodeSize func(io.Reader) (Size, error))

RegisterFormat registers an image format for use by Decode. Name is the name of the format, like "jpeg" or "png". Magic is the magic prefix that identifies the format's encoding. The magic string can contain "?" wildcards that each match any one byte. Decode is the function that decodes the encoded image. DecodeSize is the function that decodes just its configuration.

Types

type FormatError

type FormatError string

A FormatError reports that the input is not a valid JPEG.

func (FormatError) Error

func (e FormatError) Error() string

type Size

type Size struct {
	Width, Height int
}

func DecodeSize

func DecodeSize(r io.Reader) (Size, string, error)

DecodeSize decodes the dimensions of an image that has been encoded in a registered format. The string returned is the format name used during format registration. Format registration is typically done by an init function in the codec-specific package.

type UnsupportedError

type UnsupportedError string

An UnsupportedError reports that the input uses a valid but unimplemented JPEG feature.

func (UnsupportedError) Error

func (e UnsupportedError) Error() string

Jump to

Keyboard shortcuts

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