node-bitmap is a pure JavaScript library designed for low-level bitmap image manipulation within Node.js environments. Published over a decade ago as version 0.0.1, this package offers basic functionalities for creating and modifying uncompressed bitmap data, including setting and getting individual pixel values. It was developed to run on very old Node.js versions (>=v0.6.5) and has seen no updates or maintenance since its initial release. Consequently, it is considered abandoned and lacks compatibility with modern JavaScript features, Node.js versions, and security patches. Its primary differentiator was its 'pure JavaScript' implementation, avoiding native dependencies at a time when such libraries often required them, but this also means it is likely slower and less feature-rich than contemporary alternatives.
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
This package exclusively uses CommonJS `require()` syntax as it predates Node.js ESM support. Attempting to use `import` will result in a runtime error.
const Bitmap = require('node-bitmap');
The primary export is a constructor function (class in modern terms) named `Bitmap`. Instances are created using the `new` keyword.
const bmp = new Bitmap(width, height);
Demonstrates how to initialize a new bitmap, set individual pixel colors, and retrieve pixel data using the CommonJS `require` syntax.
const Bitmap = require('node-bitmap');
// Create a new 100x50 pixel bitmap with a default background (often black)
const width = 100;
const height = 50;
const bmp = new Bitmap(width, height);
// Set a pixel at (10, 20) to red (RGBA)
bmp.setPixel(10, 20, 255, 0, 0, 255);
// Get the pixel data at (10, 20)
const pixel = bmp.getPixel(10, 20);
console.log(`Pixel at (10, 20): R=${pixel.r}, G=${pixel.g}, B=${pixel.b}, A=${pixel.a}`);
// Fill a small square with blue
for (let y = 5; y < 15; y++) {
for (let x = 5; x < 15; x++) {
bmp.setPixel(x, y, 0, 0, 255, 255);
}
}
// In a real application, you would then convert this bitmap to a buffer
// for saving to a file or sending over a network, e.g., bmp.toBuffer();
// (Note: The `toBuffer` method might not be directly available or might need
// specific arguments; this quickstart focuses on pixel manipulation.)
console.log(`Created a ${width}x${height} bitmap and manipulated pixels.`);
// Example of accessing raw buffer (highly dependent on implementation)
// console.log('Bitmap raw buffer size:', bmp.buffer.length);
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.