@alt1/imagedata-loader
TypeScript icon, indicating that this package has built-in type declarations

1.0.0-alpha.6 • Public • Published

Alt1 ImageData Loader

This loader loads png images as ImageBuffer objects to use their raw pixels. Using this loader will fix several pitfalls with the png specification. In particular it removes the sRGB header to prevent discoloration of the raw pixels. This loader returns a Promise which resolves to an ImageData object.

Installation

npm i @alt1/font-loader -s

Usage

//webpack.config.json

module.exports={
	...
	module: {
		rules: [
			...
			{
				test: /\.data.png$/,
				loader: ['@alt1/imagedata-loader']
			}
		]
	}
}
//app.js

//required for ImageData.prototype.show and also used by the client sided part of the loader
import "@alt1/base";

require("./img.png").then(buffer=>{
	buffer.show();
})

Readme

Keywords

none

Package Sidebar

Install

npm i @alt1/imagedata-loader

Weekly Downloads

14

Version

1.0.0-alpha.6

License

none

Unpacked Size

7.08 kB

Total Files

9

Last publish

Collaborators

  • skillbert