letterbox

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2019 License: MIT Imports: 13 Imported by: 0

README

Letterbox

A tiny Go program to batch-process letter-boxing of photographs.

Installation

$ go get github.com/tj/letterbox/cmd/letterbox

Usage

Usage of letterbox:
  -aspect string
    	Output aspect ratio (default "16:9")
  -concurrency int
    	Concurrency of image processing (default 8)
  -force
    	Force image reprocess when it exists
  -output string
    	Image output directory (default "processed")
  -padding int
    	Output image padding in percentage
  -quality int
    	Output jpeg quality (default 90)
  -white
    	Output a white letterbox

Examples

Example of 1:1

$ letterbox -aspect 1:1

Example of 4:3

$ letterbox -aspect 4:3

Example of 16:9 (the default)

$ letterbox -aspect 16:9

Example of explicitly listing images:

$ letterbox DSCF6719.jpg DSCF6718.jpg

Example of 1:1 with a white background and 6% padding:

$ letterbox -white -aspect 1:1 -padding 6


GoDoc

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Processor) error

Option function.

func WithAspect

func WithAspect(ratio string) Option

WithAspect changes the aspect ratio which defaults to "16:9".

func WithConcurrency

func WithConcurrency(n int) Option

WithConcurrency changes the processing concurrency.

func WithForce

func WithForce(v bool) Option

WithForce changes whether or not to force re-processing of existing images.

func WithPadding

func WithPadding(n int) Option

WithPadding changes the image padding which is applied as a percentage.

func WithQuality

func WithQuality(n int) Option

WithQuality changes the jpeg output quality, from 0-100.

func WithWhiteBackground

func WithWhiteBackground(v bool) Option

WithWhiteBackground changes the background color to white.

type Processor

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

Processor is a batch image processor for automating cropping and letterboxes.

func New

func New(dir string, options ...Option) (*Processor, error)

New processor outputting to dir with the given options.

func (*Processor) Process

func (p *Processor) Process(ctx context.Context, images []string) error

Process the given images.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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