thumbnail

package module
v0.0.0-...-27aac58 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2026 License: MIT Imports: 7 Imported by: 0

README

imgutils-thumbnail

Thumbnail generation

Documentation

Overview

Package thumbnail provides simple thumbnail generation for images.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(src image.Image, opts Options) image.Image

Generate creates a thumbnail from the source image. It maintains aspect ratio, fitting within the specified dimensions.

func GenerateAndSave

func GenerateAndSave(inputPath, outputPath string, opts Options) error

GenerateAndSave is a convenience function that generates a thumbnail and saves it to a file.

func GenerateFromFile

func GenerateFromFile(path string, opts Options) (image.Image, error)

GenerateFromFile reads an image file and generates a thumbnail.

func SaveGIF

func SaveGIF(img image.Image, w io.Writer) error

SaveGIF saves the thumbnail as a GIF file.

func SaveJPEG

func SaveJPEG(img image.Image, w io.Writer, quality int) error

SaveJPEG saves the thumbnail as a JPEG file.

func SavePNG

func SavePNG(img image.Image, w io.Writer) error

SavePNG saves the thumbnail as a PNG file.

Types

type Options

type Options struct {
	Width   int
	Height  int
	Quality int // JPEG quality (1-100), default 85
}

Options configures thumbnail generation.

func DefaultOptions

func DefaultOptions() Options

DefaultOptions returns sensible defaults for thumbnail generation.

Jump to

Keyboard shortcuts

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