22
33This is a part of [ Node3D] ( https://github.com/node-3d ) project.
44
5- [ ![ NPM] ( https://badge.fury.io/js/image-raub .svg )] ( https://badge.fury.io/js/image-raub )
6- [ ![ ESLint ] ( https://github.com/node-3d/image-raub /actions/workflows/eslint .yml/badge.svg )] ( https://github.com/node-3d/image-raub /actions/workflows/eslint .yml )
7- [ ![ Test] ( https://github.com/node-3d/image-raub /actions/workflows/test.yml/badge.svg )] ( https://github.com/node-3d/image-raub /actions/workflows/test.yml )
8- [ ![ Cpplint] ( https://github.com/node-3d/image-raub /actions/workflows/cpplint.yml/badge.svg )] ( https://github.com/node-3d/image-raub /actions/workflows/cpplint.yml )
5+ [ ![ NPM] ( https://badge.fury.io/js/%40node-3d%2Fimage .svg )] ( https://badge.fury.io/js/@node-3d/image )
6+ [ ![ Lint ] ( https://github.com/node-3d/image/actions/workflows/lint .yml/badge.svg )] ( https://github.com/node-3d/image/actions/workflows/lint .yml )
7+ [ ![ Test] ( https://github.com/node-3d/image/actions/workflows/test.yml/badge.svg )] ( https://github.com/node-3d/image/actions/workflows/test.yml )
8+ [ ![ Cpplint] ( https://github.com/node-3d/image/actions/workflows/cpplint.yml/badge.svg )] ( https://github.com/node-3d/image/actions/workflows/cpplint.yml )
99
1010``` console
11- npm i -s image-raub
11+ npm install @node-3d/ image
1212```
1313
1414Using [ FreeImage] ( http://freeimage.sourceforge.net/ ) , this addon loads images from:
@@ -29,15 +29,15 @@ Additional features:
2929
3030> Note: this ** addon uses N-API** , and therefore is ABI-compatible across different
3131 Node.js versions. Addon binaries are precompiled and ** there is no compilation**
32- step during the ` npm i ` command.
32+ step during the ` npm install ` command.
3333
3434
3535## Image
3636
3737``` js
38- import Image from ' image-raub ' ;
38+ import { Image } from ' @node-3d/image ' ;
3939const image = new Image (' images/test.png' ); // relative to CWD
40- icon .on (' load' , () => { console .log (' data' , image .width , image .height , image .data ); });
40+ image .on (' load' , () => { console .log (' data' , image .width , image .height , image .data ); });
4141```
4242
4343For loaded images, ` image.data ` will contain a ` Buffer ` of ` 4 * width * height ` bytes.
@@ -47,12 +47,10 @@ to a file or use it any other way.
4747With ` Image.fromPixels() ` it is possible to generate new images from scratch by providing
4848your own data buffer.
4949
50- See [ TS declarations] ( /index.d.ts ) for more details.
51-
5250
5351### Set window icon
5452
55- Compatible with [ glfw-raub ] ( https://github.com/node-3d/glfw-raub ) ` window.icon ` property.
53+ Compatible with [ @ node-3d/glfw ] ( https://github.com/node-3d/glfw ) ` window.icon ` property.
5654
5755``` js
5856const icon = new Image ();
@@ -69,7 +67,7 @@ available as a `Buffer`, containing the whole pixel data, and `image.width`/`ima
6967contain the dimensions.
7068
7169``` js
72- const Image = require ( ' image-raub ' ) ;
70+ import { Image } from ' @node-3d/image ' ;
7371const image = new Image ();
7472// Web-style onload
7573image .onload = () => {
@@ -106,4 +104,3 @@ const img = Image.fromPixels(screen.w, screen.h, 32, storage.data);
106104
107105img .save (` ${ Date .now ()} .jpg` );
108106```
109-
0 commit comments