imgsz

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: May 6, 2024 License: GPL-3.0 Imports: 14 Imported by: 38

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

Overview

Package bmp implements a BMP image decoder and encoder.

The BMP specification is at http://www.digicamsoft.com/bmp/bmp.html.

Package tiff implements a TIFF image tiffdecoder and encoder.

The TIFF specification is at http://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf

Index

Constants

This section is empty.

Variables

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

ErrFormat indicates that decoding encountered an unknown format.

View Source
var ErrUnsupported = errors.New("bmp: unsupported BMP image")

ErrUnsupported means that the input BMP image uses a valid but unsupported feature.

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