Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
The bmp-js npm package is a JavaScript library for encoding and decoding BMP (Bitmap) image files. It allows you to read BMP files, manipulate their data, and write BMP files. This can be useful for applications that need to handle BMP images directly, such as image processing tools, graphic editors, or any application that needs to work with BMP files.
Decode BMP
This feature allows you to decode a BMP file into a JavaScript object. The object contains information about the BMP file, such as width, height, and pixel data.
const bmp = require('bmp-js');
const fs = require('fs');
const bmpBuffer = fs.readFileSync('path/to/your/image.bmp');
const bmpData = bmp.decode(bmpBuffer);
console.log(bmpData);
Encode BMP
This feature allows you to encode a JavaScript object into a BMP file. You can specify the pixel data, width, and height of the image, and then write the encoded BMP data to a file.
const bmp = require('bmp-js');
const fs = require('fs');
const bmpData = {
data: Buffer.from([/* pixel data */]),
width: 100,
height: 100
};
const rawData = bmp.encode(bmpData);
fs.writeFileSync('path/to/your/output.bmp', rawData.data);
Jimp is a JavaScript Image Manipulation Program that supports various image formats, including BMP, PNG, JPEG, and GIF. It provides a wide range of image processing functionalities such as resizing, cropping, and color manipulation. Compared to bmp-js, Jimp offers more comprehensive image processing capabilities but may be more complex to use for simple BMP encoding/decoding tasks.
Sharp is a high-performance image processing library for Node.js that supports various image formats, including BMP, JPEG, PNG, WebP, and TIFF. It is known for its speed and efficiency, making it suitable for server-side image processing tasks. While sharp offers extensive image manipulation features, it is more focused on performance and may be overkill for simple BMP handling compared to bmp-js.
Image-js is a comprehensive image processing library for JavaScript that supports multiple image formats, including BMP. It provides a wide range of image manipulation functions such as filtering, transformation, and analysis. Image-js is more feature-rich compared to bmp-js, making it suitable for more complex image processing tasks.
A pure javascript Bmp encoder and decoder for node.js
Supports all bits decoding(1,4,8,16,24,32) and encoding with 24bit.
##Install
$ npm install bmp-js
###Decode BMP
var bmp = require("bmp-js");
var bmpBuffer = fs.readFileSync('bit24.bmp');
var bmpData = bmp.decode(bmpBuffer);
bmpData
has all properties includes:
fileSize,reserved,offset
headerSize,width,height,planes,bitPP,compress,rawSize,hr,vr,colors,importantColors
palette
data-------byte array order by ABGR ABGR ABGR,4 bytes per pixel
###Encode RGB
var bmp = require("bmp-js");
//bmpData={data:Buffer,width:Number,height:Height}
var rawData = bmp.encode(bmpData);//default no compression,write rawData to .bmp file
U can use on free with MIT License
FAQs
A pure javascript BMP encoder and decoder
The npm package bmp-js receives a total of 822,741 weekly downloads. As such, bmp-js popularity was classified as popular.
We found that bmp-js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.