A suite to track Project Diva score statistics and ratings / D4DJ event data.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
projectdivar/server/node_modules/image-decode/png.js

20 lines
356 B

// decode png buffer
'use strict'
var PNG = require('pngjs').PNG
var toab = require('to-array-buffer')
module.exports = function read (data, o) {
var imgData = PNG.sync.read(Buffer.from(data))
var pixels = new Uint8Array(toab(imgData.data))
return {
data: pixels,
width: imgData.width | 0,
height: imgData.height | 0
}
}