slicerdicer

package
v0.0.0-...-fcc9e47 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package slicerdicer provides a very simple API to crop image objects and slice image objects into same-sized pieces.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPointOutOfBounds     = errors.New("point is out of bounds")
	ErrDimensionOutOfBounds = errors.New("dimension is out of bounds")
)

Functions

func Crop

func Crop(img image.Image, x, y, dx, dy int) (image.Image, error)

Crop returns an image which is cropped by the given dimensions dx and dy starting at the point x and y.

Errors are returned when the given point and dimensions are out of the image bounds.

func Slice

func Slice(img image.Image, partsPerSide int) ([][]image.Image, error)

Slice takes an image and an ammount of slices per side. The passed image is then sliced into partsPerSide * partsPerSide pieces with the size of imgX / partsPerSide times imgY / partsPerSide. The resulting pieces are returned in a two-dimensional array of image instances arranged in the order of the original image.

Errors are returned if the calculated sizes are out of bounds of the passed image.

Types

This section is empty.

Jump to

Keyboard shortcuts

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