https://github.com/evanw/skew-nanojpeg
A port of the NanoJPEG library
https://github.com/evanw/skew-nanojpeg
Last synced: 3 months ago
JSON representation
A port of the NanoJPEG library
- Host: GitHub
- URL: https://github.com/evanw/skew-nanojpeg
- Owner: evanw
- Created: 2015-10-12T22:28:46.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2019-06-10T00:23:29.000Z (almost 6 years ago)
- Last Synced: 2025-02-28T18:26:23.696Z (3 months ago)
- Language: HTML
- Size: 25.4 KB
- Stars: 7
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# JavaScript JPEG Parser
This is a port of Martin Fiedler's [NanoJPEG library](http://keyj.emphy.de/nanojpeg/) from C to [Skew](http://skew-lang.org). It supports both grayscale and RGB JPEGs but doesn't support progressive or CMYK JPEGs. I've also added automatic EXIF orientation correction. For development, first install the compiler using `npm install`, then invoke the compiler using `npm run build`.
Usage:
var encoded; // Input: a JPEG file as a Uint8Array
var decoded = decodeJPEG(encoded); // Or "require('nanojpeg').decodeJPEG(encoded);" for node
if (decoded !== null) {
console.log('width', decoded.width);
console.log('height', decoded.height);
console.log('rgb', decoded.rgb);
}* Install: `npm install nanojpeg`
* Download: [nanojpeg.js](http://evanw.github.io/skew-nanojpeg/nanojpeg.js) (less than 10kb)
* Live demo: [http://evanw.github.io/skew-nanojpeg/](http://evanw.github.io/skew-nanojpeg/)