# guess-image-layout

> Guess the Layout of Image Pixels. Returns layout in xdim layout syntax.

Latest version **0.1.0** (published 2022-06-25) · CC0-1.0 license · 0 weekly downloads

## Install

```sh
npm install guess-image-layout
pnpm add guess-image-layout
yarn add guess-image-layout
bun add guess-image-layout
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2022-06-25 |
| First published | 2021-09-25 |
| Weekly downloads | 0 |
| License | CC0-1.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 12.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Daniel J. Dufour |
| Maintainers | danieljdufour |
| Keywords | band, image, jpg, layout, pixels, png, xdim |

## Links

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

## Dependencies (1)

- [get-depth](https://npm.io/package/get-depth.md) ^0.0.3

## Alternatives

- [exif-parser](https://npm.io/package/exif-parser.md) — 3.8M weekly downloads
- [vite-plugin-compression](https://npm.io/package/vite-plugin-compression.md) — 569.5K weekly downloads
- [pica](https://npm.io/package/pica.md) — 442.4K weekly downloads
- [@reportportal/client-javascript](https://npm.io/package/@reportportal/client-javascript.md) — 408.8K weekly downloads
- [@tldraw/state](https://npm.io/package/@tldraw/state.md) — 316.0K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2022-06-25
- 0.0.3 — 2021-09-29
- 0.0.2 — 2021-09-25
- 0.0.1 — 2021-09-25

## README

# guess-image-layout
Guess the Layout of Image Pixels.  Returns layout in [xdim layout syntax](https://github.com/danieljdufour/xdim).

# install
```bash
npm install guess-image-layout
```

# basic usage
```js
import guessImageLayout from "guess-image-layout";

const rgba = [123, 234, 42, 255, 124, 42, 42, 255, ...];
guessImageLayout({ data: rgba, bands: 4, height: 768  });
// { layout: "[row,column,band]", bands: 4, height: 768, width: 1024 }

const bands = [
  [123, 124, ...], // red band
  [234, 42, ...], // green band
  [42, 42, ...], // blue band
  [255, 255, ...] // alpha band
];
guessImageLayout({ data: bands });
// { layout: "[band][row,column]", bands: 4, height: undefined, width: undefined }
```

# advanced usage
If you already know the array of layout of the data, you can pass that in and it will calculate what it can.
```js
import guessImageLayout from "guess-image-layout";

const rgba = [123, 234, 42, 255, 124, 42, 42, 255, ...];

guessImageLayout({ data: rgba, layout: "[band][row,column]" })
// { "bands": 4, "layout": "[band][row,column]", height: undefined, width: undefined }
```

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