check progressive jpeg
Check if an image is a progressive jpg or not.
Why nuwanda ? See the Dead Poets Society.
NodeJS >= v0.8 (http://nodejs.org/)
nuwanda can be used and installed globally (there's a binary)
npm install nuwanda -g
- only tested on macosx
windows and linux support in the next version
OR pipe a jpg to it
cat file.jpg | nuwanda
OR with the provided index.js file
node index.js file.jpg
OR as a module, just listen to the progressive event. The emitted value is true if the jpg is progressive, false if not (?! ;-)
var fs = require'fs'nuwanda = require'nuwanda'Nuwanda;var file = fscreateReadStreamprocessargv2;var progressiveCheck = file;progressiveCheckon'progressive'if flag console.log'progressive';;
OR as a module but with a raw buffer
var fs = require'fs'nuwanda = require'nuwanda'Nuwanda;var file = fsreadFileSyncprocessargv2;var flag = file buffer:trueprogressive;if flag console.log'progressive';
Not so much error handling for the moment
nuwanda is a readable stream that takes a stream as an input (stdin or file for instance). As soon as it detects the progressive jpeg marker (0xff 0xc2), it emits a "progressive" event and stop reading the input (handy for bug files ...)
- windows /linux tests
I wanted to easily detect if a jpeg is progressive or not, I love nodejs and I wanted to play with streams.
substack for his node-stream handbook, node community in general
Do what you want. Have fun with JS.