Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@3846masa/bmp
Advanced tools
Create a BMP (w/ alpha channel) binary from RGBA raw bytes like ImageData.
Create a BMP (w/ alpha channel) binary from RGBA raw bytes like ImageData.
See ./examples/basic.
<script type="module">
import { convert } from 'https://unpkg.com/@3846masa/bmp/lib/convert.mjs';
const canvas = document.getElementById('canvas');
const bmpImg = document.getElementById('bmp');
function main() {
const ctx = canvas.getContext('2d');
const raw = ctx.getImageData(0, 0, canvas.width, canvas.height);
const bmpBinary = convert(raw);
const blob = new Blob([bmpBinary], { type: 'image/bmp' });
bmpImg.src = URL.createObjectURL(blob);
}
main();
</script>
See ./examples/webworker.
<script type="module">
import { convert } from 'https://unpkg.com/@3846masa/bmp/lib/worker.mjs';
const canvas = document.getElementById('canvas');
const bmpImg = document.getElementById('bmp');
async function main() {
const ctx = canvas.getContext('2d');
const raw = ctx.getImageData(0, 0, canvas.width, canvas.height);
const bmpBinary = await convert(raw);
const blob = new Blob([bmpBinary], { type: 'image/bmp' });
bmpImg.src = URL.createObjectURL(blob);
}
main().catch(console.error);
</script>
See ./examples/canvas-to-blob.
<script src="https://unpkg.com/@3846masa/bmp/lib/polyfill.js"></script>
<script>
const canvas = document.getElementById('canvas');
const bmpImg = document.getElementById('bmp');
function main() {
canvas.toBlob(callback, 'image/bmp');
function callback(blob) {
bmpImg.src = URL.createObjectURL(blob);
}
}
main();
</script>
npm i @3846masa/bmp
import { convert } from '@3846masa/bmp';
convert({ width, height, data }, options?)
Convert RGBA raw bytes like ImageData to a BMP binary.
In worker.mjs
, this function returns Promise.
width | number |
height | number |
data | Uint8Array | Uint8ClampedArray |
options.strict | boolean |
Returns | Uint8Array | Promise<Uint8Array> |
HTMLCanvasElement.prototype.toBlob(callback, type)
callback | (blob: Blob) => any |
type | 'image/bmp' |
PRs accepted.
FAQs
Create a BMP (w/ alpha channel) binary from RGBA raw bytes like ImageData.
We found that @3846masa/bmp 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.