image

package
v0.0.0-...-c24f211 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MIME_TYPE_JPEG = "image/jpeg"
	MIME_TYPE_PNG  = "image/png"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Image

type Image struct {
	InternalImage image.Image
}

Image is a struct

func NewImageFromLocation

func NewImageFromLocation(location string) (*Image, error)

NewImageFromLocation return an image from location

func NewImageFromReader

func NewImageFromReader(reader io.Reader) (*Image, error)

NewImageFromReader return an image from Reader

func (Image) Save

func (img Image) Save(w io.Writer, mimeType string, jpegQuality int) error

func (Image) SaveToLocation

func (img Image) SaveToLocation(location, mimeType string, jpegQuality int) error

type Margin

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

type NoOpTransformation

type NoOpTransformation struct {
}

NoOpTransformation is a no-op transformation

func NewNoOpTransformation

func NewNoOpTransformation() NoOpTransformation

NoOpTransformation return an instance of WaterMarkProcessing

func (NoOpTransformation) Apply

func (p NoOpTransformation) Apply(image *Image) Result

Apply is a NoOpTransformation apply method

type RelativePosition

type RelativePosition int

RelativePosition

const (
	// TopLeft is relative from top-left
	TopLeft RelativePosition = iota
	// TopRight is relative from top-right
	TopRight
	// BottomLeft is relative from bottom-left
	BottomLeft
	// BottomRight is relative from bottom-right
	BottomRight
)

type Resize

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

type Result

type Result struct {
	Data  *Image
	Error error
}

Result is a result

type Transformation

type Transformation interface {
	Apply(*Image) Result
}

Transformation is a transformation interface

type WaterMarkProcessing

type WaterMarkProcessing struct {
	//WaterMark is a watermark image
	WaterMark *Image

	//RelativePosition where the watermark image being positioned
	RelativePosition RelativePosition

	//Margin is a margin information used in accordance with the RelativePosition
	Margin Margin

	//ResizePercentage is resize percentage being applied to watermark image
	ResizePercentage Resize
}

WaterMarkProcessing is a class that can be used for applying watermark

func NewWaterMarkProcessing

func NewWaterMarkProcessing(watermark *Image) WaterMarkProcessing

NewWaterMarkProcessing return an instance of WaterMarkProcessing

func (WaterMarkProcessing) Apply

func (p WaterMarkProcessing) Apply(img *Image) Result

Apply is a waterMarkProcessing apply method

Jump to

Keyboard shortcuts

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