Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@3846masa/bmp

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@3846masa/bmp - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

2

package.json

@@ -8,3 +8,3 @@ {

"repository": "git+ssh://git@github.com/3846masa/bmp.git",
"version": "1.0.0",
"version": "1.0.1",
"main": "lib/convert.cjs",

@@ -11,0 +11,0 @@ "module": "lib/covert.mjs",

@@ -9,3 +9,3 @@ # @3846masa/bmp

- faster than other libraries (e.g. bmp-js)
- tiny size (~ 500 bytes)
- tiny size (basic: ~ 500 bytes, webworker: ~ 700 bytes)
- supports alpha channel

@@ -31,3 +31,6 @@

![basic](https://flat.badgen.net/badgesize/gzip/https/unpkg.com/@3846masa/bmp/lib/convert.mjs)
[![codesandbox-badge]](https://codesandbox.io/s/github/3846masa/bmp/tree/master/examples/basic)
See [./examples/basic](./examples/basic).
```html

@@ -37,12 +40,16 @@ <script type="module">

const canvas = document.getElementById('#canvas');
const ctx = canvas.getContext('2d');
const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
const canvas = document.getElementById('canvas');
const bmpImg = document.getElementById('bmp');
const uint8 = convert(imageData);
const blob = new Blob([uint8], { type: 'image/bmp' });
function main() {
const ctx = canvas.getContext('2d');
const img = new Image();
img.src = URL.createObjectURL(blob);
document.body.appendChild(img);
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>

@@ -54,3 +61,6 @@ ```

![webworker](https://flat.badgen.net/badgesize/gzip/https/unpkg.com/@3846masa/bmp/lib/worker.mjs)
[![codesandbox-badge]](https://codesandbox.io/s/github/3846masa/bmp/tree/master/examples/webworker)
See [./examples/webworker](./examples/webworker).
```html

@@ -60,13 +70,13 @@ <script type="module">

const canvas = document.getElementById('canvas');
const bmpImg = document.getElementById('bmp');
async function main() {
const canvas = document.getElementById('#canvas');
const ctx = canvas.getContext('2d');
const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
const uint8 = await convert(imageData);
const blob = new Blob([uint8], { type: 'image/bmp' });
const raw = ctx.getImageData(0, 0, canvas.width, canvas.height);
const bmpBinary = await convert(raw);
const blob = new Blob([bmpBinary], { type: 'image/bmp' });
const img = new Image();
img.src = URL.createObjectURL(blob);
document.body.appendChild(img);
bmpImg.src = URL.createObjectURL(blob);
}

@@ -80,17 +90,25 @@

![no-module](https://flat.badgen.net/badgesize/gzip/https/unpkg.com/@3846masa/bmp/lib/polyfill.mjs)
![no-module](https://flat.badgen.net/badgesize/gzip/https/unpkg.com/@3846masa/bmp/lib/polyfill.js)
[![codesandbox-badge]](https://codesandbox.io/s/github/3846masa/bmp/tree/master/examples/canvas-to-blob)
See [./examples/canvas-to-blob](./examples/canvas-to-blob).
```html
<script src="https://unpkg.com/@3846masa/bmp/lib/polyfill.js"></script>
<script>
async function main() {
const canvas = document.getElementById('#canvas');
const blob = new Promise((resolve) => canvas.toBlob(resolve, 'image/bmp'));
const canvas = document.getElementById('canvas');
const bmpImg = document.getElementById('bmp');
const img = new Image();
img.src = URL.createObjectURL(blob);
document.body.appendChild(img);
function main() {
canvas.toBlob(callback, 'image/bmp');
function callback(blob) {
const blobUrl = URL.createObjectURL(blob);
bmpImg.addEventListener('load', () => URL.revokeObjectURL(blobUrl), { once: true });
bmpImg.addEventListener('error', () => URL.revokeObjectURL(blobUrl), { once: true });
bmpImg.src = blobUrl;
}
}
main().catch(console.error);
main();
</script>

@@ -101,3 +119,3 @@ ```

![bundlephobia](https://flat.badgen.net/bundlephobia/min/@3846masa/bmp)
![bundlephobia](https://flat.badgen.net/bundlephobia/minzip/@3846masa/bmp?label=gzip%20size)

@@ -146,1 +164,2 @@ ```sh

[mit-license]: https://3846masa.mit-license.org
[codesandbox-badge]: https://flat.badgen.net/badge/codesandbox/try%20it/black
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc