pp

profile-pic

Create cover and profile pictures with face centered and uniform expected sizes

Showing:

Popularity

Downloads/wk

2

GitHub Stars

8

Maintenance

Last Commit

5yrs ago

Contributors

2

Package

Dependencies

2

Size (min+gzip)

264.0KB

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

Profile Picture

Build Status

Create cover and profile pictures with face centered and uniform expected sizes.

It gets an input image and outputs three images: a cover image centered with specified size in landscape and portrait, and a profile picture with square ratio centered in bigest detected human face.

Install

npm install profile-pic

Usage

var profilePic = require('profile-pic');
var images = [
    /* Landscape Ratio */
    {
        width: 400,
        height: 240,
        filename: '/tmp/landscape.jpg'
    },
    /* Portrait Ratio */
    {
        width: 240,
        height: 400,
        filename: '/tmp/standing.jpg'
    },
    /* detected face avatar with square ratio */
    {
        avatar: true,
        width: 128,
        height: 128,
        filename: '/tmp/profile.jpg'
    }
];

profilePic('./test-image.jpeg', images)
    .then(function (result) {
        /*
        [ { width: 400, height: 240, filename: '/tmp/landscape.jpg' },
          { width: 240, height: 400, filename: '/tmp/standing.jpg' },
          { avatar: true,
            width: 128,
            height: 128,
            filename: '/tmp/profile.jpg',
            faces: 5 } ]
        */
    })
    .catch(function (err) {
        // Something bad happened ...
    });

This example will result in 3 images out of this input:

INPUT:

input

OUTPUT:

  • Two centered and resized to expected size:
400x240

landscape.jpg (400x240)

200x120

standing.jpg (400x240)

  • And one avatar image with biggest detected face:
128x128

profile.jpg (128x128)

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100