# texture2cube

> Generate a cube like image from three textures without canvas, which could allow a server side system to do this work.

Latest version **1.0.2** (published 2018-05-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install texture2cube
pnpm add texture2cube
yarn add texture2cube
bun add texture2cube
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2018-05-27 |
| First published | 2018-05-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 9.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Necolo Lv.C |
| Maintainers | necolo |

## Links

- npm: https://www.npmjs.com/package/texture2cube
- Repository: https://github.com/Necolo/Texture2Cube
- Homepage: https://github.com/Necolo/Texture2Cube#readme
- Issues: https://github.com/Necolo/Texture2Cube/issues
- npm.io page: https://npm.io/package/texture2cube

## Dependencies (8)

- [get-pixels](https://npm.io/package/get-pixels.md) ^3.3.0
- [typescript](https://npm.io/package/typescript.md) ^2.8.3
- [@types/node](https://npm.io/package/@types/node.md) ^9.6.6
- [bit-twiddle](https://npm.io/package/bit-twiddle.md) ^1.0.2
- [color-blend](https://npm.io/package/color-blend.md) ^1.0.3
- [ndarray-ops](https://npm.io/package/ndarray-ops.md) ^1.2.2
- [save-pixels](https://npm.io/package/save-pixels.md) ^2.3.4
- [ndarray-warp](https://npm.io/package/ndarray-warp.md) ^1.0.1

## Recent versions

- 1.0.2 (latest) — 2018-05-27
- 1.0.1 — 2018-05-27
- 1.0.0 — 2018-05-27

## README

# Texure2Cube

Generate a cube like image from three textures without canvas, which could allow a server side system to do this work.

`Texture2Cube` uses [ndarray](https://github.com/scijs/ndarray) to load image data, then use this data to transform the textures.

## usage 

Install and import it as a module. 
```
npm i texture2cube 
```

Here shows a basic example: 
```js
var CubeImage = require('texture2cube');

var cubeImage = new CubeImage({
    top: 'texture_top.png',
    left: 'texture_left.png',
    rignt: 'texture_right.png',
})

cubeImage.toPng('./cube.png');
```

## API

**Constructor**  

constructor accepts five inputs:
- `left`: left texture
- `right`: right texture
- `top`: top texture
- `scale`: (optional)scale the output image
- `info`: (optional)can pass some data and get by `cubeImage.getPixels`

**Output**  

- `cubeImage.toCanvas(element)`: append a canvas to element.
- `cubeImage.toCanvas()`: append a canvas to body
- `cubeImage.toPng('result.png')` output to a png file  
- `cubeImage.getPixels(callback(pixels, info))`: pixels are the ndarray type of the result image data, info is the data from constructor.

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