imgff

package module
v0.0.0-...-436d0ac Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2022 License: MIT Imports: 3 Imported by: 0

README

imgff - Quick image file format detection

Determine image file format by reading just a few header bytes.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error string

Error represents package level errors. Implements builtin.error interface.

const (
	// ErrUnknownFormat means that format can't be determined.
	ErrUnknownFormat Error = "unknown format"
)

func (Error) Error

func (e Error) Error() string

type FileFormat

type FileFormat string

FileFormat represents file format.

const (
	JPEG FileFormat = "jpg"
	// PNG represents png image format.
	PNG FileFormat = "png"
	// BMP represents bmp image format.
	BMP FileFormat = "bmp"
	// GIF represents gif image format.
	GIF FileFormat = "gif"
	// AVIF represents avif image format.
	AVIF FileFormat = "avif"
	// WEBP represents webp image format.
	WEBP FileFormat = "webp"
)

Enumeration of supported image formats.

func Format

func Format(file *os.File) (FileFormat, error)

Format tries to determine image file format.

func FormatMust

func FormatMust(file *os.File) FileFormat

FormatMust tries to determine image file format. In rare cases can panic if error occurs.

func (FileFormat) String

func (f FileFormat) String() string

Jump to

Keyboard shortcuts

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