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

@tikkhun/bmp

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tikkhun/bmp

用于一位 bmp 图的转换等。

  • 0.0.0
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
0
Weekly downloads
 
Created
Source

bmp encoder decoder

用于一位 bmp 图的转换等。

使用

import bmp from "@tikkhun/bmp";

export async function bmpTo1Bit(image) {
  const buffer = await image.getBufferAsync(Jimp.MIME_BMP);
  const bitmap = bmp.decode(buffer);
  bitmap.bitPP = 1;
  const { data } = bmp.encode(bitmap);
  return data;
}

完整例子

import Jimp from "jimp";
async function bootstrap() {
  const imagePath = "test.png";
  const image = await Jimp.read(imagePath);
  const buffer = await image.getBufferAsync(Jimp.MIME_BMP);
  const oneBitBmpBuffer = await bmpTo1Bit(buffer);
  const savedPath = "test.bmp"
  fs.writeFileSync(savedPath, oneBitBmpBuffer);
}
bootstrap();

FAQs

Package last updated on 15 Aug 2024

Did you know?

Socket

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.

Install

Related posts

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