croptop

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2021 License: MIT Imports: 4 Imported by: 0

README

Croptop Github Actions Coverage Status Go Report Card

An easy to use image cropping library built on top of imaging. This package is just a wrapper to imaging.

Installation

$ go get github.com/stevenferrer/croptop

Example

  1. Decode image from a reader.
img, err := croptop.Decode(r)
// handle error
  1. Specify crop options and encode to a writer.
err = img.Height(height).Width(width).
    OffsetX(offsetX).OffsetY(offsetY).
    Crop().Encode(w)
// handle error

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Image

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

Image is an image

func Decode

func Decode(r io.Reader) (*Image, error)

Decode reads the image from r

func (*Image) Crop

func (i *Image) Crop() *Image

Crop crops and returns a new image

func (*Image) Encode

func (i *Image) Encode(w io.Writer) error

Encode writes the image to w

func (*Image) Height

func (i *Image) Height(height float64) *Image

Height sets the bounding box height

func (*Image) OffsetX

func (i *Image) OffsetX(x float64) *Image

OffsetX sets the x-coordinate offset

func (*Image) OffsetY

func (i *Image) OffsetY(y float64) *Image

OffsetY sets the y-coordinate offset

func (*Image) Width

func (i *Image) Width(width float64) *Image

Width sets the bounding box width

Jump to

Keyboard shortcuts

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