Node.js module for 6px
Node.js module for interacting with the 6px API. This module includes methods to make the process of sending images to 6px for processing easier.
Getting Started
Install the NPM package:
$ npm install 6px
More examples can be found in the examples directory, but here's a sample of adding a watermark to an image:
var px = require('6px')({
userId: '***USER_ID***',
apiKey: '***API_KEY***',
apiSecret: '***API_SECRET***'
});
var image = px({
taxi: './images/unsplash_city_taxi.jpg',
logo: 'http://6px.io/img/px-logo-md@2x.png'
});
var output = image.output({ taxi: 'unsplashed_6px_watermark' });
output.layer('logo', {
opacity: 0.6
});
output.url('6px');
output.tag('watermarked');
image.save(function(err, res) {
console.log(res);
});
All of those methods are chainable, by the way:
var px = require('6px')({
userId: '***USER_ID***',
apiKey: '***API_KEY***',
apiSecret: '***API_SECRET***'
});
var image = px({
taxi: './images/unsplash_city_taxi.jpg',
logo: 'http://6px.io/img/px-logo-md@2x.png'
});
image.output({ taxi: 'unsplashed_6px_watermark' })
.layer('logo', {
opacity: 0.6
})
.tag('watermarked')
.url('6px');
image.save(function(err, res) {
console.log(res);
});
Granted, we lost the comments, but you can see most of the methods are set up to be chainable.
More examples of what is possible can be found by visiting the 6px API documentation