'Creating small screenshots in js using the bmp-js package
In my JS code, I need to save canvas screenshots. I do it with a package bmp-js (https://www.npmjs.com/package/bmp-js)
data_GUI = await utilities.get_canvas(canvas_selector)
arr_of_data_GUI = Object.values(data_GUI)
arr_of_data_GUI = new Uint8Array(arr_of_data_GUI)
temp = bmp.encode(
{
data: arr_of_data_GUI,
width: canvas_width,
height: canvas_height
}
)
return fs.createWriteStream(file_path).write(temp.data)
My screenshots are about 3mb in size. I want to take smaller screenshots. The documentation for bmp-js has this code:
var bmp = require("bmp-js");
var rawData = bmp.encode(bmpData);//default no compression,write rawData to .bmp file
The comment to the code says "default no compression", but I can't find how to call this code with compression.
Please help me!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
