image

package
v0.0.0-...-53f8848 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Open

func Open(path string) (image.Image, error)

Open a file & return an image (supported formats only), or an error

func OpenCr2

func OpenCr2(path string) (image.Image, error)

OpenCr2 decodds the contents of the file at path & returns an image, or a non-nil error This function uses the github.com/nf/cr2 for the underlying decode operation

func ResizeAbs

func ResizeAbs(original image.Image, x, y int) (image.Image, error)

Resize the original image to the supplied size

func ResizeScale

func ResizeScale(original image.Image, percent float32) (image.Image, error)

ResizeScale the original image using scaled to percent

func Rotate

func Rotate(original image.Image, deg int) (image.Image, error)

Rotate the image by the specified degree

func Save

func Save(img image.Image, path string) error

Save the image at the specified path, or returns error

func WriteTo

func WriteTo(encoder Encoder, writer io.Writer, img image.Image) error

WriteTo encodes & write the image to a supplied io.Writer

Types

type Encoder

type Encoder interface {
	Encode(writer io.Writer, img image.Image) error
}

Encoder interface defines a simple encoder behavior that converts an image bitmap (image.Image) to a specific compression format

type GifEncoder

type GifEncoder struct{}

GifEncoder encodes images to GIF

func (*GifEncoder) Encode

func (j *GifEncoder) Encode(writer io.Writer, img image.Image) error

type ImageMetadata

type ImageMetadata struct {

	//Source metadata
	Location string

	// Dimensions metadata
	SizeBytes int64
	DimX      int64
	DimY      int64

	//Exif Metadata
	Camera            *string
	DateTaken         *time.Time
	Lat               *float64
	Long              *float64
	FocalLengthNumber *int64
	FocalLengthDenom  *int64
}

func Metadata

func Metadata(path string) (*ImageMetadata, error)

type JpegEncoder

type JpegEncoder struct {
	Quality int
}

JpegEncoder encodes images to JPEG

func NewJpegEncoder

func NewJpegEncoder(quality int) *JpegEncoder

func (*JpegEncoder) Encode

func (j *JpegEncoder) Encode(writer io.Writer, img image.Image) error

Encode image into JPEG

type PngEncoder

type PngEncoder struct{}

PngEncoder encodes images to PNG

func (*PngEncoder) Encode

func (j *PngEncoder) Encode(writer io.Writer, img image.Image) error

Jump to

Keyboard shortcuts

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