goutils

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckFile

func CheckFile(filename string) string

CheckFile checks if file exists returns "dir"|"file"|""

func GetPixels

func GetPixels(img image.Image) ([][]Pixel, error)

GetPixels gets the bi-dimensional pixel array

func HasItem

func HasItem(list []string, items ...string) bool

HasItem checks for item in given slice

func MkdirIfNot

func MkdirIfNot(dir string) error

MkdirIfNot creates the dir if not exists

func ReadDir

func ReadDir(dir string) []string

ReadDir returns the filenames in directory

func ReadDirRecursive

func ReadDirRecursive(dir string) []string

ReadDirRecursive reads the directory recursively by given depth

func SaveJSON

func SaveJSON(data interface{}, outputname string)

SaveJSON saves the given data to json

Types

type Image

type Image interface {
	Save() func(string) error
	CropNumbers() func() (image.Image, error)
	CropAndSave() func(string) error
}

Image interface for images

type ImageMetadata

type ImageMetadata struct {
	Width  int
	Height int
}

ImageMetadata contains width and height of an image

type Pixel

type Pixel struct {
	R int
	G int
	B int
	A int
}

Pixel struct of RGBA values

type TestImage

type TestImage struct {
	image.Image
	ImageMetadata
}

TestImage extends image.Image

func GetImage

func GetImage(filename string) (*TestImage, error)

GetImage returns your image and its metadata

func (*TestImage) Crop

func (i *TestImage) Crop(config cutter.Config) (TestImage, error)

Crop crops and returns the new part

func (*TestImage) CropAndSave

func (i *TestImage) CropAndSave(filename string, config cutter.Config) error

CropAndSave crops and saves to system using cutter

func (*TestImage) DetectStartingPixel

func (i *TestImage) DetectStartingPixel() int

DetectStartingPixel detects the starting pixel from left to right

func (*TestImage) RemoveBlank

func (i *TestImage) RemoveBlank(filename string) error

RemoveBlank removes the blank part from the bottom of test image and saves to system by overriding original

func (TestImage) Save

func (i TestImage) Save(filename string) error

Save saves the image to given filename output

Jump to

Keyboard shortcuts

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