# jpeg-lossless-decoder-js

> A JavaScript JPEG Lossless decoder.

Latest version **2.1.2** (published 2024-04-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install jpeg-lossless-decoder-js
pnpm add jpeg-lossless-decoder-js
yarn add jpeg-lossless-decoder-js
bun add jpeg-lossless-decoder-js
```

## Health

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

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.2 |
| Published | 2024-04-02 |
| First published | 2015-12-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.8 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 70 |
| Maintainers | rii-mango, thanayik |
| Keywords | JavaScript, JPEG, Lossless, Decoder, DICOM, 1.2.840.10008.1.2.4.57, 1.2.840.10008.1.2.4.70 |

## Links

- npm: https://www.npmjs.com/package/jpeg-lossless-decoder-js
- Repository: https://github.com/rii-mango/JPEGLosslessDecoderJS
- Issues: https://github.com/rii-mango/JPEGLosslessDecoderJS/issues
- npm.io page: https://npm.io/package/jpeg-lossless-decoder-js

## Alternatives

- [flatbuffers](https://npm.io/package/flatbuffers.md) — 6.0M weekly downloads
- [jwt-simple](https://npm.io/package/jwt-simple.md) — 259.5K weekly downloads
- [@exodus/patch-broken-hermes-typed-arrays](https://npm.io/package/@exodus/patch-broken-hermes-typed-arrays.md) — 28.5K weekly downloads
- [@native-to-anchor/buffer-layout](https://npm.io/package/@native-to-anchor/buffer-layout.md) — 12.2K weekly downloads
- [binary-parser-encoder](https://npm.io/package/binary-parser-encoder.md) — 5.3K weekly downloads

## Recent versions

- 2.1.2 (latest) — 2024-04-02
- 2.1.1 — 2024-03-27
- 2.1.0 — 2024-01-22
- 2.0.7 — 2023-05-13
- 2.0.6 — 2023-05-12
- 2.0.5 — 2023-05-10
- 2.0.4 — 2018-03-25
- 2.0.2 — 2017-03-19
- 2.0.1 — 2016-10-30
- 1.2.11 — 2016-02-16
- 1.2.10 — 2016-02-05
- 1.2.8 — 2016-02-05
- 1.2.6 — 2016-02-05
- 1.2.5 — 2016-02-05
- 1.2.3 — 2015-12-15

## README

JPEGLosslessDecoderJS
=====
A common DICOM compression format is JPEG Lossless.  This format is generally not supported in standard JPEG decoder libraries. 

This decoder can read data from the following DICOM transfer syntaxes:

- 1.2.840.10008.1.2.4.57    JPEG Lossless, Nonhierarchical (Processes 14)
- 1.2.840.10008.1.2.4.70    JPEG Lossless, Nonhierarchical (Processes 14 [Selection 1])

### Usage
[API](https://github.com/rii-mango/JPEGLosslessDecoderJS/wiki/API) and [more examples](https://github.com/rii-mango/JPEGLosslessDecoderJS/tree/master/tests)

```javascript
var decoder = new jpeg.lossless.Decoder();
var output = decoder.decompress(buffer [, offset [, length]]);

// Parameters
// {ArrayBuffer} buffer
// {Number} offset offset into buffer (default = 0)
// {Number} length length of buffer (default = end of JPEG block)

// Returns
// {ArrayBuffer} output (size = cols * rows * bytesPerComponent * numComponents)
```

### Install
Get a packaged source file from the [release folder](https://github.com/rii-mango/JPEGLosslessDecoderJS/tree/master/release):

* [lossless.js](https://raw.githubusercontent.com/rii-mango/JPEGLosslessDecoderJS/master/release/lossless.js)
* [lossless-min.js](https://raw.githubusercontent.com/rii-mango/JPEGLosslessDecoderJS/master/release/lossless-min.js)

Or install via [NPM](https://www.npmjs.com/):

```
npm install jpeg-lossless-decoder-js
```

### Testing
```
npm test
```

### Building
```
npm run build
```
This will output `lossless.js` and `lossless-min.js` alongside declaration files and source maps to `/release`.

### Acknowledgments
This decoder was originally written by Helmut Dersch for Java.  I added support for selection values 2 through 7, contributed bug fixes and ported to JavaScript.

Also thanks to [@jens-ox](https://github.com/jens-ox) for modernizing this package to TypeScript.

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