Home

Awesome

caire-openfaas

This is an OpenFaaS function for Caire content aware image resize library. This function facilitates to run the library without the need to have it installed locally.

Usage

To run the function locally you have to make sure OpenFaaS is up and running. Follow the official documentation for more details. https://docs.openfaas.com/

Clone the repository:

$ git clone https://github.com/esimov/caire-openfaas

Build

$ faas-cli build -f stack.yml --gateway=http://<GATEWAY-IP>

Deploy

$ faas-cli deploy -f stack.yml --gateway=http://<GATEWAY-IP>

sample-screen

Once the function has been deployed you can access the UI on the url defined in --gateway parameter.

You have to provide each option parameter as a JSON string, defined in the UI Request Body section. The json should have the structure of the following form:

{
	"input":"https://user-images.githubusercontent.com/883386/37569642-0c5f49e8-2aee-11e8-8ac1-d096c0387ca0.jpg", 
	"width":20,
	"height":0,
	"perc":"true",
	"scale":"false",
	"face":"true"
}

For more details about the supported options check the project page: https://github.com/esimov/caire.

Below are the supported commands:

CommandVariable TypeDescription
inputstringInput file
widthintNew width
heightintNew height
percboolReduce image by percentage
squareboolReduce image to square dimensions
scaleboolProportional scaling
debugboolUse debugger
blurintBlur radius
sobelintSobel filter threshold
facefalseUse face detection

Note: all the boolean type option should be defined as string.

Results

OriginalShrunk
broadway_tower_editbroadway_tower_edit
waterfallwaterfall
dubaidubai
boatboat
OriginalExtended
gasadalurgasadalur
dubaidubai

License

Copyright © 2018 Endre Simo

This project is under the MIT License. See the LICENSE file for the full license text.