faceCrop

package module
v0.0.0-...-428ad20 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2023 License: MIT Imports: 4 Imported by: 0

README

FaceCrop

Go Report Card

faceCrop is a GoLang package providing robust utilities for cropping faces (or any region) in images. It supports both local and Amazon S3 sources.

Installation

To install this package, run:

go get github.com/leorighi/faceCrop

Usage

Here's an example of how to use faceCrop:

package main

import (
	"fmt"
	"github.com/leorighi/faceCrop"
)

func main() {
	box := faceCrop.BoundingBox{Height: 0.5, Left: 0.25, Top: 0.25, Width: 0.5}

	// Crop local image
	localInput := faceCrop.CropLocalImageInput{ImagePath: "path/to/your/image.jpg", Box: box}
	croppedImage, err := faceCrop.CropLocalImage(localInput)
	if err != nil {
		fmt.Println("Error cropping local image:", err)
	}

	// Save the cropped image
	err = faceCrop.SaveImage(croppedImage, "path/to/save/cropped/image.jpg")
	if err != nil {
		fmt.Println("Error saving cropped image:", err)
	}
}

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CropLocalImage

func CropLocalImage(input CropLocalImageInput) (image.Image, error)

func CropS3Image

func CropS3Image(input CropS3ImageInput) (image.Image, error)

func SaveImage

func SaveImage(img image.Image, outputPath string) error

Types

type BoundingBox

type BoundingBox struct {
	Height float64
	Left   float64
	Top    float64
	Width  float64
}

type CropLocalImageInput

type CropLocalImageInput struct {
	ImagePath string
	Box       BoundingBox
}

type CropS3ImageInput

type CropS3ImageInput struct {
	Body io.ReadCloser
	Box  BoundingBox
}

Jump to

Keyboard shortcuts

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