# node-image-raub

> Native Image loader for Node.js

Latest version **0.0.5** (published 2018-01-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install node-image-raub
pnpm add node-image-raub
yarn add node-image-raub
bun add node-image-raub
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: no vulnerabilities; high maintenance score.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2018-01-22 |
| First published | 2018-01-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 7 |
| Author | Luis Blanco |
| Maintainers | raub |
| Keywords | image, node, freeimage, graphics |

## Links

- npm: https://www.npmjs.com/package/node-image-raub
- Repository: https://github.com/raub/node-image
- Homepage: https://github.com/raub/node-image#readme
- Issues: https://github.com/raub/node-image/issues
- npm.io page: https://npm.io/package/node-image-raub

## Dependencies (2)

- [node-addon-tools-raub](https://npm.io/package/node-addon-tools-raub.md) 0.1.2
- [node-deps-freeimage-raub](https://npm.io/package/node-deps-freeimage-raub.md) 0.0.3

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 0.0.5 (latest) — 2018-01-22
- 0.0.4 — 2018-01-22
- 0.0.3 — 2018-01-21
- 0.0.2 — 2018-01-20

## README

# Image for Node.js

Image crossplatform addon with minimized dependencies.


## Install

```
npm i -s node-image-raub
```

Note: as this is a compiled addon, compilation tools must be in place on your system.
Such as MSVS13 for Windows, where `npm install --global windows-build-tools` most probably helps.


## Usage

This module implements Image class suitable for loading FreeImage supported formats.

Example usage:

```js
const Image = require('node-image-raub');
const image = new Image();

image.onload = () => {
	gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, true);
	gl.bindTexture(gl.TEXTURE_2D, texture);
	gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);
	gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
	gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_NEAREST);
	gl.generateMipmap(gl.TEXTURE_2D);
	gl.bindTexture(gl.TEXTURE_2D, null);
};

image.src = `${__dirname}/texture.jpg`;
```

Here `Image` is used to load a texture. Constructed object receives src property,
then the file is read and `'load'` event emitted. After this `image.data` is
available as a Buffer, containing whole pixel data, and `image.width`/`image.height`
contain image dimensions.

Image class is supposed to provide the basic interface, which other libs, such as
three.js are looking for. However, some additional features were added, and some removed.


### Properties

* `get/set number width/naturalWidth` - image width.
* `get/set number height/naturalHeight` - image height.
* `get/set [width, height] wh` - image width and height.
* `get/set {width, height} size` - image width and height.
* `get/set string src` - image source file.
* `set function onload` - image source file.
* `get boolean complete` - if image has already been loaded.

---
_Source: https://npm.io/package/node-image-raub · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
