bmp-ts is a pure TypeScript library designed for encoding and decoding BMP image files. It currently stands at version 1.0.9, with a release cadence focused on addressing bug fixes and minor enhancements. The library distinguishes itself by offering comprehensive support for all common BMP bit depths, including 1-bit, 4-bit, 8-bit, 16-bit, 24-bit, and 32-bit images. It provides granular control over BMP header properties during the encoding process and offers an optional `toRGBA` conversion during decoding for compatibility with other image processing libraries. While it supports various compression methods for decoding, a key limitation is the lack of compression support during encoding, meaning output files will always be uncompressed.
npm install bmp-tsVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to decode an existing BMP file and encode a new BMP image from raw pixel data using `bmp-ts`.
Review the new API usage in the README or package documentation for correct method signatures and object structures.
Be aware that encoded files will be larger. If compressed BMPs are required, external tools or post-processing will be necessary.
Always append `.default` when importing `bmp-ts` in CommonJS environments: `const bmp = require('bmp-ts').default;`Upgrade to `bmp-ts@1.0.5` or a newer version to ensure correct decoding of all BMP image orientations.
Update to `bmp-ts@1.0.4` or a later version to resolve CommonJS import problems and ensure proper module loading.
In CommonJS, explicitly use `.default`: `const bmp = require('bmp-ts').default;`.Use `import bmp from 'bmp-ts';` to import the default export directly.
Ensure the object passed to `bmp.encode` strictly conforms to the `BmpDataInput` interface, including `data` (Buffer), `width` (number), `height` (number), and `bitPP` (number).
Upgrade `bmp-ts` to version `1.0.5` or newer. If upgrading isn't possible, manual image data manipulation might be required to flip the image vertically after decoding.
No dependency data recorded yet.