snakethumb

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: MIT Imports: 8 Imported by: 0

README

snake-thumb 🐍🖼️

A lightweight, 100% Pure Go image thumbnail generator designed specifically for Cloud and Serverless environments (AWS Lambda, Google Cloud Run, etc.).

Features

  • Zero OS dependencies (No CGO, No ImageMagick, No libjpeg): Compiles into a single, ultra-lightweight static binary that runs anywhere.
  • Cloud Agnostic: Decoupled from any specific cloud vendor. Easily stream thumbnails directly to AWS S3, Google Cloud Storage, Azure Blob, or local disk using a simple custom adapter interface.
  • Fast Resizing: Uses high-quality Catmull-Rom resampling filters under the hood.

Installation

go get https://github.com/marcocrottidea/snake-thumb

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Widths      map[Size]int
	JPEGQuality int
}

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

func NewGenerator

func NewGenerator(cfg Config) *Generator

func (*Generator) Process

func (g *Generator) Process(src io.Reader) (map[Size][]ImageOutput, error)

func (*Generator) ProcessAndUpload

func (g *Generator) ProcessAndUpload(ctx context.Context, src io.Reader, uploader Uploader, bucket, baseKey string) error

type ImageOutput

type ImageOutput struct {
	Data        []byte
	Format      string
	ContentType string
}

type Size

type Size string
const (
	Small    Size = "small"
	Medium   Size = "medium"
	Large    Size = "large"
	Original Size = "original"
)

type Uploader

type Uploader interface {
	Upload(ctx context.Context, bucket, key string, data []byte, contentType string) error
}

Jump to

Keyboard shortcuts

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