Socket
Socket
Sign inDemoInstall

bmpimagejs

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    bmpimagejs

pure bmp decoder library for nodejs, support all bmp formats,converted from http://www.netsurf-browser.org/projects/libnsbmp/


Version published
Maintainers
1
Install size
38.6 kB
Created

Readme

Source

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);
        }

    });

Keywords

FAQs

Last updated on 13 Jan 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc