@types/bmp-js
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

Installation

npm install --save @types/bmp-js

Summary

This package contains type definitions for bmp-js (https://github.com/shaozilee/bmp-js).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/bmp-js.

index.d.ts

/// <reference types="node" />

export interface ImageData {
    readonly data: Buffer;
    readonly height: number;
    readonly width: number;
}

export type Encode = (imgData: ImageData, quality?: number) => ImageData;

/**
 * Bmp format decoder, support 1bit 4bit 8bit 24bit bmp
 */
export class BmpDecoder implements ImageData {
    private pos: number;
    data: Buffer;
    fileSize: number;
    reserved: number;
    offset: number;
    headerSize: number;
    width: number;
    height: number;
    planes: number;
    bitPP: number;
    compress: number;
    rawSize: number;
    hr: number;
    vr: number;
    colors: number;
    importantColors: number;
    bottom_up: boolean;

    palette: Array<{
        red: number;
        green: number;
        blue: number;
        quad: number;
    }>;

    constructor(buffer: Buffer, is_with_alpha?: boolean);

    /**
     * Returns the data buffer - byte array order by ABGR ABGR ABGR,4 bytes per pixel
     */
    getData(): Buffer;

    private parseHeader(): void;
    private parseRGBA(): void;
    private bit1(): void;
    private bit4(): void;
    private bit8(): void;
    private bit15(): void;
    private bit16(): void;
    private bit24(): void;
    private bit32(): void;
}

export type Decode = (bmpData: Buffer) => BmpDecoder;

/**
 * var bmp = require("bmp-js");
 * var bmpBuffer = fs.readFileSync('bit24.bmp');
 * var bmpData = bmp.decode(bmpBuffer);
 */
export const decode: Decode;

/**
 * var bmp = require("bmp-js");
 * var rawData = bmp.encode(bmpData); //default no compression,write rawData to .bmp file
 */
export const encode: Encode;

Additional Details

  • Last updated: Mon, 06 Nov 2023 22:41:05 GMT
  • Dependencies: @types/node

Credits

These definitions were written by Robert Krahn.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.1.01,045ts2.8
0.1.01,045ts2.9
0.1.01,045ts3.0
0.1.01,045ts3.1
0.1.01,045ts3.2
0.1.01,045ts3.3
0.1.01,045ts3.4
0.1.01,045ts3.5
0.1.01,045ts3.6
0.1.01,045ts3.7
0.1.01,045ts3.8
0.1.01,045ts3.9
0.1.01,045ts4.0
0.1.01,045ts4.1
0.1.01,045ts4.2
0.1.01,045ts4.3
0.1.01,045ts4.4
0.1.2776ts5.7
0.1.2776ts5.6
0.1.2776latest
0.1.2776ts4.5
0.1.2776ts4.6
0.1.2776ts4.7
0.1.2776ts4.8
0.1.2776ts4.9
0.1.2776ts5.0
0.1.2776ts5.1
0.1.2776ts5.2
0.1.2776ts5.3
0.1.2776ts5.4
0.1.2776ts5.5
0.1.2776ts5.8

Version History

VersionDownloads (Last 7 Days)Published
0.1.2776
0.1.12
0.1.01,045

Package Sidebar

Install

npm i @types/bmp-js

Weekly Downloads

1,823

Version

0.1.2

License

MIT

Unpacked Size

5.82 kB

Total Files

5

Last publish

Collaborators

  • types