Skip to content

esimov/caire-openfaas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

Command Variable Type Description
input string Input file
width int New width
height int New height
perc bool Reduce image by percentage
square bool Reduce image to square dimensions
scale bool Proportional scaling
debug bool Use debugger
blur int Blur radius
sobel int Sobel filter threshold
face false Use face detection

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

Results

Original Shrunk
broadway_tower_edit broadway_tower_edit
waterfall waterfall
dubai dubai
boat boat
Original Extended
gasadalur gasadalur
dubai dubai

License

Copyright © 2018 Endre Simo

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