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.
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
$ faas-cli build -f stack.yml --gateway=http://<GATEWAY-IP>
$ faas-cli deploy -f stack.yml --gateway=http://<GATEWAY-IP>
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.
Original | Shrunk |
---|---|
Original | Extended |
---|---|
Copyright © 2018 Endre Simo
This project is under the MIT License. See the LICENSE file for the full license text.