NodeJS 6px SDK
Wrapper to the 6px image processing API. Includes methods to make the process of sending over jobs easier.
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');
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
})
.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.