images

package
v0.0.0-...-3d3ee04 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cropped

func Cropped(ext string, read io.ReadSeeker, x1, y1, x2, y2 int) (cropped io.ReadSeeker, err error)

func FixJpgOrientation

func FixJpgOrientation(data []byte) (oriented []byte)

many code is copied from http://camlistore.org/pkg/images/images.go

func MaybePreprocessImage

func MaybePreprocessImage(filename string, data []byte, width, height int) (resized io.ReadSeeker, w int, h int)

* Preprocess image files on client side. * 1. possibly adjust the orientation * 2. resize the image to a width or height limit * 3. remove the exif data * Call this function on any file uploaded to SeaweedFS *

func Resized

func Resized(ext string, read io.ReadSeeker, width, height int, mode string) (resized io.ReadSeeker, w int, h int)

Types

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{}
}

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