images

package
v0.0.0-...-825e40b Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2013 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Width, Height int
	Format        string
	Modified      bool // true if Decode actually rotated or flipped the image.
}

Config is like the standard library's image.Config as used by DecodeConfig.

func Decode

func Decode(r io.Reader, opts *DecodeOpts) (image.Image, Config, error)

Decode decodes an image from r using the provided decoding options. The Config returned is similar to the one from the image package, with the addition of the Modified field which indicates if the image was actually flipped or rotated. If opts is nil, the defaults are used.

type DecodeOpts

type DecodeOpts struct {
	// Rotate specifies how to rotate the image.
	// If nil, the image is rotated automatically based on EXIF metadata.
	// If an int, Rotate is the number of degrees to rotate
	// counter clockwise and must be one of 0, 90, -90, 180, or
	// -180.
	Rotate interface{}

	// Flip specifies how to flip the image.
	// If nil, the image is flipped automatically based on EXIF metadata.
	// Otherwise, Flip is a FlipDirection bitfield indicating how to flip.
	Flip interface{}

	// MaxWidgth and MaxHeight optionally specify bounds on the
	// final image's size.
	MaxWidth, MaxHeight int
}

type FlipDirection

type FlipDirection int

The FlipDirection type is used by the Flip option in DecodeOpts to indicate in which direction to flip an image.

const (
	FlipVertical FlipDirection = 1 << iota
	FlipHorizontal
)

FlipVertical and FlipHorizontal are two possible FlipDirections values to indicate in which direction an image will be flipped.

Jump to

Keyboard shortcuts

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