bmpimagejs
pure bmp decoder library for nodejs, support all bmp formats,converted from http://www.netsurf-browser.org/projects/libnsbmp/
Last updated 2 years ago by hamzakilic .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install bmpimagejs 
SYNC missed versions from official npm registry.

bmpimagejs

pure javascript nodejs library for decoding all bmp files converted from c library http://www.netsurf-browser.org/projects/libnsbmp/

#npm link
https://www.npmjs.com/package/bmpimagejs

#install
npm install bmpimagejs --save

#build
gulp buildsrc

#test
gulp runspec

#usage

var bmp=require('bmpimagejs');
var fs=require('fs');
fs.readFile('filename', (err, data) => {
try{

        let img= bmp.decode(data.buffer); 
        //if decoding fails, throws a DecodeError;          
        //otherwise returns an RGBA image object
        console.log(img.width);
        console.log(img.height);
        console.log(img.pixels);
        for(var y=0;y<img.height;++y)
        for(var x=0;x<img.width;++x){
            var pixelPos=y*img.width*4+x*4;
            img.pixels[pixelPos]=10;//set R
            img.pixels[pixelPos+1]=10;//set G
            img.pixels[pixelPos+2]=10;//set B
            img.pixels[pixelPos+3]=10;//set A
        }
        
        }catch(ex){
            console.log(ex.errNumber);
            console.log(ex.message);
        }

    });

Current Tags

  • 1.0.4                                ...           latest (2 years ago)

5 Versions

  • 1.0.4                                ...           2 years ago
  • 1.0.3                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
  • 1.0.1                                ...           2 years ago
  • 1.0.0                                ...           2 years ago
Maintainers (1)
Downloads
Today 0
This Week 1
This Month 1
Last Day 0
Last Week 0
Last Month 2
Dependencies (0)
None
Dev Dependencies (6)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |