smartcircle
copy of github.com/po3rin/smartcircle
Automatically determine where to crop a circular image out of a rectangular.
Installation
$ go get github.com/po3rin/smartcircle/cmd/smartcircle
Try this on Web
you enabled to try here !! (developed by Go + Wasm)
https://po3rin.github.io/smartcircle/web/
Usage
as CLI tool.
$ smartcircle -f testdata/gopher.jpeg -o cropped.png
as Code.
package main
import (
_ "image/jpeg"
"image/png"
"os"
"github.com/po3rin/smartcircle"
)
func main(){
img, _ := os.Open(*imgPath)
defer img.Close()
src, _, _ := image.Decode(img)
// use smartcircle packege.
c, _ := smartcircle.NewCropper(smartcircle.Params{Src: src})
result, _ := c.CropCircle()
file, _ := os.Create("cropped.png")
defer file.Close()
_ = png.Encode(file, result)
}