# node-pixels

> Pixels.js Adapter for Node (https://silvia-odwyer.github.io/pixels.js/)

Latest version **0.0.1** (published 2023-09-11) · Apache-2.0 license license · 0 weekly downloads

## Install

```sh
npm install node-pixels
pnpm add node-pixels
yarn add node-pixels
bun add node-pixels
```

## 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.0.1 |
| Published | 2023-09-11 |
| First published | 2023-09-11 |
| Weekly downloads | 0 |
| License | Apache-2.0 license |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 97.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Silvia Odwyer |
| Maintainers | mdjfs |
| Keywords | typescript, library, pixels, image, filters, node, processing, web, canvas, filter, brightness, saturation, contrast, greyscale |

## Links

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

## 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.0.1 (latest) — 2023-09-11

## README

# Pixels Library

[![npm version](https://badge.fury.io/js/node-pixels.svg)](https://badge.fury.io/js/node-pixels)

Library for image web manipulation. Using the Pixels.js library (https://silvia-odwyer.github.io/pixels.js/)

## Table of Contents

- [Installation](#installation)
- [Usage](#usage)

## Installation

You can install the Pixels Image React Component using npm:

```bash
npm install node-pixels
```

or yarn:

```bash
yarn add node-pixels
```

## Usage


### Basic Use

```javascript
import Pixels from 'node-pixels';

async function loadFilter(element) {
  const canvas = document.createElement("canvas"); // create canvas
  const source = await Pixels.getImageSource(element); // get source of <img> element
  let { context, data } = await Pixels.drawImageSource(canvas, source); // draw image into canvas
  await Pixels.adjustColors(data, {
    brightness: 0.5,
    saturation: 0.2,
    contrast: -0.3
  }); // adjust colors (example values)
  await Pixels.loadFilter(data, "coral"); // or ["coral", ...] to apply more than one filter
  await Pixels.applyChanges(data, context); // apply changes into context
  await Pixels.setVerticalFlip(canvas, context); // apply vertical flip
  await Pixels.setHorizontalFlip(canvas, context); // apply horizontal flip
  element.src = canvas.toDataURL("image/png"); // draw image into element (change mimetype if is needed) 

  // reset changes:
  Pixels.reset(source, context);
  element.src = canvas.toDataURL("image/png"); // draw image into element (change mimetype if is needed)
}

loadFilter(document.getElementById("my-image"));

```

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