go-legofy

command module
v0.0.0-...-fc1ac91 Latest Latest
Warning

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

Go to latest
Published: May 16, 2019 License: MIT Imports: 6 Imported by: 0

README

Go Legofy

Build Status

Go Report Card

GitHub issues GitHub forks GitHub stars GitHub license

What is it?

Go Legofy is a Go lang utility library that takes a static image and makes it so that it looks as if it was built out of LEGO.

Before
Before
After
After

Quickstart

$ go get github.com/winhtaikaung/go-legofy

Usage

    //Legofy from image path
import (
	"fmt"
	"image"
	_ "image/jpeg"
	"image/png"
	_ "image/png"
	"os"

	"github.com/winhtaikaung/go-legofy/legofy"
)

func main() {
	fmt.Println("Lego My lovely Lego")
	//Legofy from image path
	sourceImagePath := "gopher.png"
	imgChanel := make(chan *legofy.LegoImage)
	go legofy.LegofyImagePath(sourceImagePath, 50, imgChanel)
	img := <-imgChanel
	close(imgChanel)
	fmt.Println(img.BrickCount)
	legofy.SaveAsJPEG("lego_with_path", img.Image, 100)

	// legofy from image.Image data type
	source, _ := os.Open(sourceImagePath)
	defer source.Close()
	sourceImg, _, _ := image.Decode(source) // Image Struct
	imgChanel = make(chan *legofy.LegoImage)
	go legofy.LegofyImage(sourceImg, 50, imgChanel)
	img = <-imgChanel
	close(imgChanel)
	legofy.SaveAsPNG("lego_with_img", img.Image, png.BestCompression)

}

Docs

https://godoc.org/github.com/winhtaikaung/go-legofy/legofy

Bugs

If you find a bug:

  1. Check in the open issues if the bug already exists.
  2. If the bug is not there, create a new issue with clear steps on how to reproduce it.

ToDo

  • Image Palette

Contributing

  1. Fork it ( https://github.com/winhtaikaung/go-legofy )
  1. Create your feature branch (git checkout -b my-new-feature)
  1. Commit your changes (git commit -am 'Add some feature')
  1. Push to the branch (git push origin my-new-feature)
  1. Create a new Pull Request

License

MIT

Twitter

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package legofy provides legolized image of user-defined static images (PNG,JPG)
Package legofy provides legolized image of user-defined static images (PNG,JPG)

Jump to

Keyboard shortcuts

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