tiletools

package module
v0.0.0-...-5427deb Latest Latest
Warning

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

Go to latest
Published: May 3, 2022 License: MIT Imports: 8 Imported by: 0

README

About

GoDoc

Command-line tools to process tile set images

Provides tileslicer, tilejoiner, tilecutter and tileflipper commands.

Installation

go get -u github.com/martinlindhe/tile-tools/...

Usage - tileslicer

Slices input image into several tiles.

You have a tile map:

have

You want to slice it into equally sized tiles:

want

$ tileslicer 1.png --out ./parts --width 32 --height 32

Usage - tilejoiner

Combines all images in a folder into a new tile set

You have a bunch of equally sized tiles:

want

You want to combine them to a tile map:

have

$ tilejoiner ./parts --out 1.png --tiles-per-row 6

Usage - tilecutter

Keeps bottom 1/3:rd of input images

$ tilecutter --keep-bottom --one-third _tmp

Usage - tileflipper

Flip (mirror) input image

$ tileflipper _samples/ground.png --out flipped-ground-h.png --horizontal
$ tileflipper _samples/ground.png --out flipped-ground-v.png --vertical

License

Under MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetPartOfImage

func GetPartOfImage(fileName string, section Section, keepSize KeepSize) (*image.RGBA, error)

GetPartOfImage returns specified Section and Size of image

func LoadImage

func LoadImage(filename string) (image.Image, string, error)

LoadImage loads a image from disk

func SliceImage

func SliceImage(imgFile string, tileWidth int, tileHeight int, force bool) ([]image.Image, error)

SliceImage slices input imgFile into smaller tiles

func WriteImages

func WriteImages(imgs []image.Image, dstDir string) error

WriteImages saves a slice of images to disk

Types

type KeepSize

type KeepSize int

KeepSize indicates the size of the image to keep

const (
	OneThird KeepSize = iota
	Half
	TwoThirds
)

...

type Section

type Section int

Section indicates which part of the image to keep

const (
	Top Section = iota
	Bottom
	Left
	Right
)

...

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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