Releases: Datamosh-js/datamosh
Releases · Datamosh-js/datamosh
v1.4.1
v1.4.0
Changes:
- Support passing multiple modes as array
- Clean up error messages
Example code:
;(function throwAnElbow () {
let read = require('fs').readFileSync
let write = require('fs').writeFileSync
let img = read('/path/to/read/in.jpg')
require('./index')(
{
read: img,
mode: ['vana', 'veneneux', 'fatcat']
},
(err, moshedImg) => {
if (err) return console.error(err)
console.log('Moshing Completed!')
write('/path/to/write/out.jpg', moshedImg)
}
)
})()
v1.3.0
v1.2.1
v1.2.0
v1.1.0
Add custom modes via function prop MODES
let m = require('./index')
console.log(m.MODES)
/*
{ blurbobb: [Function], schifty: [Function] }
*/
m.MODES.boop = function (original) {
const bitmapData = original.bitmap.data
const data = Buffer.from(bitmapData)
// manipulate data here
original.bitmap.data = data
return original
}
console.log(m.MODES)
/*
{ blurbobb: [Function], schifty: [Function], boop: [Function] }
*/
m(
{
read: '/home/m/Desktop/0.jpeg',
write: '/home/m/Desktop/1.jpeg',
mode: 'boop'
},
(err, data) => {
if (err) return console.error(err)
console.log('Moshing Completed!')
}
)
console.log(m.MODES)
/*
{ blurbobb: [Function], schifty: [Function], boop: [Function] }
*/