Using NPM: npm install faceapp
Using Yarn: yarn add faceapp
First, import the module
const faceapp = require('faceapp')
The function takes two parameters:
path: string | file: Buffer- Path to the image file you would like to process. Or a Buffer object representing an image.filterID: string- FaceApp Filter ID
// Import the module const faceapp = require('faceapp') // Process the image (filepath) let image = await faceapp.process('path/to/image.png', 'smile_2') // Process the image (buffer) // First we have to get a buffer let res = await superagent.get('http://example.com/image.png') let image = await faceapp.process(res.body, 'hot')
There are some known Filter IDs:
no-filtersmilesmile_2hotoldyoungfemale_2femalemalepanhitmanhollywoodheisenbergimpressionliongoateehipsterbangsglasseswavemakeup
However, you can get an up-to-date list of all available filter IDs from the API directly using the listFilters function.
let filters = await faceapp.listFilters() // Returns an array of Filter objects let filters = await faceapp.listFilters(true) // Returns an array filter ID strings