s3f4 / smartcircle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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)
}

smartcircle

About


Languages

Language:JavaScript 52.7%Language:Go 36.1%Language:HTML 10.8%Language:Makefile 0.3%Language:Shell 0.1%