parse-hdr
v1.0.0
Published
Parses HDR (Radiance) file
Downloads
296
Readme
parse-hdr
Parses HDR (Radiance) files
Usage
hdrInfo = parseHDR(buffer)
Parameters:buffer
- Uint8Array or ArrayBuffer
Returned object properties:shape
- an array representing [width, height]
of the imageexposure
- exposure of the imagegamma
- gamma of the imagedata
- floating point pixel array [R, G, B, R, G, B, ..]
of length = width * height * 3
Example
var parseHDR = require('parse-hdr')
var io = require('pex-io')
io.loadBinary(__dirname + '/garage.hdr', function (err, buffer) {
var img = parseHDR(buffer)
console.log(img.shape) // [1024, 512]
console.log(img.exposure) // 1
console.log(img.gamma) // 1
console.log(img.data[1]) // 1.427, 1.066666, ...
})
License
MIT, see LICENSE.md for details.