image

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package image provides functionality to create thumbnails, decode and recognise images

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodeThumbnail

func EncodeThumbnail(img image.Image, maxWidth, maxHeight uint) ([]byte, error)

EncodeThumbnail encodes a given image into a JPEG thumbnail given maximum dimensions and then returns its byte contents

Types

type Type

type Type int

Type represents an image format

const (
	PNG Type = iota
	JPEG
	GIF
	WEBP
	TIFF
	BMP
)

func InferType

func InferType(fp string) (Type, error)

InferType attempts to guess a files image type based on its filepath and fails if not possible

func (Type) Decode

func (t Type) Decode(r io.Reader) (image.Image, error)

Decode decodes an image given its type

func (Type) MimeType

func (t Type) MimeType() string

MimeType returns the image mimetype, used for sending the image over the web

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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