# @wasm-codecs/oxipng

> Oxipng image encoder in WebAssembly

Latest version **1.0.1** (published 2020-08-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install @wasm-codecs/oxipng
pnpm add @wasm-codecs/oxipng
yarn add @wasm-codecs/oxipng
bun add @wasm-codecs/oxipng
```

## 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.1 |
| Published | 2020-08-06 |
| First published | 2020-05-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 353.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 69 |
| Author | Cyril Wanner |
| Maintainers | cyrilwanner |
| Keywords | wasm, webassembly, image, codec, oxipng |

## Links

- npm: https://www.npmjs.com/package/@wasm-codecs/oxipng
- Repository: https://github.com/cyrilwanner/wasm-codecs
- Homepage: https://github.com/cyrilwanner/wasm-codecs/tree/master/packages/oxipng#readme
- Issues: https://github.com/cyrilwanner/wasm-codecs/issues
- npm.io page: https://npm.io/package/@wasm-codecs/oxipng

## 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

- 1.0.1 (latest) — 2020-08-06
- 1.0.0 — 2020-05-22

## README

# `@wasm-codecs/oxipng` [![npm version](https://badgen.net/npm/v/@wasm-codecs/oxipng)](https://www.npmjs.com/package/@wasm-codecs/oxipng) [![license](https://badgen.net/github/license/cyrilwanner/wasm-codecs)](https://github.com/cyrilwanner/wasm-codecs/blob/master/LICENSE) [![downloads](https://badgen.net/npm/dt/@wasm-codecs/oxipng)](https://www.npmjs.com/package/@wasm-codecs/oxipng)

> Oxipng WebAssembly Codec

## Table of contents

1. [Installation](#installation)
1. [Usage](#usage)
1. [API](#api)
1. [Examples](#examples)
1. [License](#license)

## Installation

```bash
npm install @wasm-codecs/oxipng
```

**Requirements:**
- Node.js 10 or later

## Usage

```typescript
import encode from '@wasm-codecs/oxipng';

(async () => {
  const encodedImage = await encode(image, encodeOptions);
})();
```

## API

### `encode(image, encodeOptions?): Buffer`

Returns a buffer containing the compressed image data.

##### `image: Buffer`

Buffer of a PNG image.

##### `encodeOptions?: EncodeOptions`

All encoding options are optional and fall back to the [default values](https://github.com/cyrilwanner/wasm-codecs/blob/master/packages/oxipng/src/options.ts#L3-L5).

```typescript
type EncodeOptions = {
  level?: number;
}
```

## Examples

### Using Node.js

```typescript
import fs from 'fs';
import encode from '@wasm-codecs/oxipng';

// read input image as a buffer
const data = fs.readFileSync('in.png');

// encode the image using @wasm-codecs/oxipng
const output = encode(data);

// save the image to the file system
fs.writeFileSync('out.png', output);
```

## License

Licensed under the [MIT](https://github.com/cyrilwanner/wasm-codecs/blob/master/LICENSE) license.

© Copyright Cyril Wanner

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