# scanahedron

> Easy image scan interface for node.

Latest version **0.1.1** (published 2018-04-02) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2018-04-02 |
| First published | 2018-04-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 51.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| Author | benahedron |
| Maintainers | benahedron |
| Keywords | scanner, scan, images, node, sane |

## Links

- npm: https://www.npmjs.com/package/scanahedron
- Repository: https://github.com/benahedron/scanahedron
- Homepage: https://github.com/benahedron/scanahedron#readme
- Issues: https://github.com/benahedron/scanahedron/issues
- npm.io page: https://npm.io/package/scanahedron

## Dependencies (2)

- [nan](https://npm.io/package/nan.md) ^2.10.0
- [cmake-js](https://npm.io/package/cmake-js.md) ^3.6.2

## 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.1.1 (latest) — 2018-04-02

## README

# Scanahedron

## About
Easy image scanning module for node.

Scanahedron scans images with minimal effort, but still allows for a flexible configuration.

## Usage
Scan to file with the default scanner:
```
const scanahedron = require("path-to/libscanahedron.node")
scanahedron.scanToFile(null, "test.png");
```

Scan to buffer with a specific scanner:
```
const scanahedron = require("path-to/libscanahedron.node")
const scanners = scanahedron->getScanners();
const myScanner = filterScanner(scanners);
const buffer = scanahedron.scanToBuffer(myScanner, myScanner);

console.log(buffer.width);
console.log(buffer.height);
console.log(buffer.bytesPerPixel);
console.log(buffer.pixels);
```

Scan only the first 5 cm:
```
const scanahedron = require("path-to/libscanahedron.node")
const scanners = scanahedron.getScanners();
let configuration = scanahedron.getConfiguration(scanners[0]);
configuration.toY = 50;
scanahedron.setConfiguration(scanners[0], configuration);

scanahedron.scanToFile(scanners[0], "output.png");
```

Dump the scanner's capabilities:

```
const scanahedron = require("path-to/libscanahedron.node")
const scanners = scanahedron.getScanners();
let capabilities = scanahedron.getCapabilities(scanners[0]);
console.log(capabilities);
```

## Development Notes
The project is cmake based and uses cmake-js to configure/build the node module.

### Dependencies
- libsane-dev
- libpng-dev
- libpng++-dev

### Building
Required cmake-js:
```
npm install nan --save
npm install cmake-js --save #(or install globaly with -g option)
```

Then to build in release mode just call:
```
cmake-js
```

To build in debug:
```
cmake-js -D
```

### Testing
GTest & Gmock are required for the unit tests.
Hence install the following package (apt install):
- libgtest-dev

To build with tests enabled run:
```
cmake-js --CDBUILD_TESTS=On
```

Run the test the by simply executing the build/tests file.

#### Notes
If GTest library cannot be found you have to build it:
```
cd /usr/src/gtest # (or /usr/src/googletest/googletest/)
sudo cmake CMakeLists.txt
sudo make

#copy or symlink libgtest.a and libgtest_main.a to your /usr/lib folder
sudo cp *.a /usr/lib
```

Same for GMock:
```
cd /usr/src/gmock # (or /usr/src/googletest/googlemock/)
sudo cmake CMakeLists.txt
sudo make

#copy or symlink libgmock.a and libgmock_main.a to your /usr/lib folder
sudo cp *.a /usr/lib
```

### Credits
The project uses the FindSane.cmake file from [here](https://github.com/rose-compiler/rose/blob/master/cmake/modules/FindSane.cmake).

### Licensing

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