thumb

package
v1.0.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2019 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ThumbnailMaxWidth サムネイルの最大幅
	ThumbnailMaxWidth = 360
	// ThumbnailMaxHeight サムネイルの最大高さ
	ThumbnailMaxHeight = 480
)

Variables

View Source
var (
	// ErrFileThumbUnsupported この形式のファイルのサムネイル生成はサポートされていない
	ErrFileThumbUnsupported = errors.New("generating a thumbnail of the file is not supported")
)

Functions

func CalcThumbnailSize

func CalcThumbnailSize(size image.Point, maxSize image.Point) image.Point

CalcThumbnailSize サムネイル画像のサイズを計算します

func EncodeToJPG

func EncodeToJPG(img image.Image) (b *bytes.Buffer, err error)

EncodeToJPG image.Imageをjpgのバイトバッファにエンコードします

func EncodeToPNG

func EncodeToPNG(img image.Image) (b *bytes.Buffer, err error)

EncodeToPNG image.Imageをpngのバイトバッファにエンコードします

func Generate

func Generate(ctx context.Context, src io.Reader, mime string) (image.Image, error)

Generate サムネイル画像を生成します

func Resize

func Resize(img image.Image, maxWidth, maxHeight int) image.Image

Resize imgをリサイズします。アスペクト比は保持されます。

Types

This section is empty.

Jump to

Keyboard shortcuts

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