Skip to content

Bitmap file loader complete with transformations and filters, written in Typescript.

Notifications You must be signed in to change notification settings

notadamking/bitmap-ts

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bitmap-ts

A typescript library for loading, transforming, and filtering BMP images, directly from the browser. This is a port from RequireJS to NPM (https://github.com/testica/bitmap-ts).

Installation

$ npx install bitmap-ts

OR

$ yarn add bitmap-ts

Example Usage

import { Bitmap } from 'bitmap-ts';

const handleFileChange = (event: React.ChangeEvent<HTMLInputElement>) => {
    const file: File = event.target.files![0];
    const bmp = new Bitmap(file);

    bmp.read((response: Bitmap) => {
      this.imageData = response.currentData();
    });

    const image = new Image();

    image.onload = () => {
      this.imageHeight = image.height;
      this.imageWidth = image.width;
    };

    image.src = URL.createObjectURL(file);
}

Credits: Leonardo Testa & Carlos Abreu

About

Bitmap file loader complete with transformations and filters, written in Typescript.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 48.4%
  • TypeScript 47.2%
  • HTML 3.6%
  • CSS 0.8%