Need to encode to 1-bit BMP
- Dominant language
- TypeScript
- Stars
- 14.7k
- Forks
- 777
- PR merge metrics
- No merged PRs in 30d
Description
**Is your feature request related to a problem? Please describe.**
I have web service that receives PNG/JPEG and converts them into BMPs. The generated BMP is then requested by a low-powered microcontroller (esp8266) and then displayed in a small B&W 2.7 inch E-Ink display. The microcontroller has some issues with timeouts when image sizes are "large".
**Describe the solution you'd like**
I would like the option to encode as a 1-bit BMP output. Currently, If I read a 58Kb JPEG image the BMP output (with resizing as well as removing color) comes out as a 143Kb. If I use gimp to convert to 1-bit indexed color the result is 7Kb!
Adding a . bitPP - Bits per pixel option where I can set to 1 to encode will be ideal.
**Describe alternatives you've considered**
Here is the code I'm using:
```javascript
const fs = require('fs');
const Jimp = require('jimp');
test();
async function test() {
const image = await Jimp.read('lion.jpeg');
await image
.contain(264, 176, Jimp.HORIZONTAL_ALIGN_CENTER | Jimp.VERTICAL_ALIGN_MIDDLE)
.greyscale()
.contrast(0.8)
.dither565()
.deflateStrategy(0)
.filterType(Jimp.PNG_FILTER_NONE)
.colorType(0)
.background(0xFFFFFFFF)
.rotate(90)
.writeAsync('lion.bmp');
const orig = fs.statSync('lion.jpeg');
const result = fs.statSync('lion.bmp');
console.log(`${orig.size / 1000.0}kb`, `${result.size / 1000.0}kb`);
}
```
**Additional context**


Contributor guide
Assessment
This issue has not been assessed yet.