diff --git a/README.md b/README.md index 455bd259..29ec608b 100644 --- a/README.md +++ b/README.md @@ -325,6 +325,54 @@ sequencer.insertSteps({ return value: **`sequencer`** (To allow method chaining) +## Creating a User Interface + +Image Sequencer provides the following events which can be used to generate a UI: + +* `onSetup` : this event is triggered when a new module is set up. This can be used, +for instance, to generate a DIV element to store the generated image for that step. +* `onDraw` : This event is triggered when Image Sequencer starts drawing the output +for a module. This can be used, for instance, to overlay a loading GIF over the DIV +generated above. +* `onComplete` : This event is triggered when Image Sequencer has drawn the output +for a module. This can be used, for instance, to update the DIV with the new image +and remove the loading GIF generated above. +* `onRemove` : This event is triggered when a module is removed. This can be used, +for instance, to remove the DIV generated above. + +How to define these functions: + +```js +sequencer.setUI({ + onSetup: function() {}, + onDraw: function() {}, + onComplete: function(output) {}, + onRemove: function() {} +}); +``` + +These methods can be defined and re-defined at any time, but it is advisable to +set them before any module is added and not change it thereafter. This is because +the `setUI` method will only affect the modules added after `setUI` is called. + +The `onComplete` event is passed on the output of the module. + +In the scope of all these events, the following variables are present, which +may be used in generating the UI: +* The object `identity` +``` +identity = { + stepName: "Name of the Step", + stepID: "A unique ID given to the step", + imageName: "The name of the image to which the step is added." +} +``` +* The variable `options.inBrowser` which is a Boolean and is `true` if the client is a browser and `false` otherwise. + +Note: `identity.imageName` is the "name" of that particular image. This name can be specified +while loading the image via `sequencer.loadImage("name","SRC")`. If not specified, +the name of a loaded image defaults to a name like "image1", "image2", et cetra. + ## Contributing Happily accepting pull requests; to edit the core library, modify files in `/src/`. To build, run `npm install` and `grunt build`. diff --git a/dist/image-sequencer.js b/dist/image-sequencer.js index 30f2e76e..c3946ed2 100644 --- a/dist/image-sequencer.js +++ b/dist/image-sequencer.js @@ -359,7 +359,7 @@ var objectKeys = Object.keys || function (obj) { return keys; }; -},{"util/":114}],2:[function(require,module,exports){ +},{"util/":111}],2:[function(require,module,exports){ 'use strict' exports.byteLength = byteLength @@ -476,186 +476,8 @@ function fromByteArray (uint8) { } },{}],3:[function(require,module,exports){ -var Base64Encode = require('./lib/encode'); -var Base64Decode = require('./lib/decode'); -module.exports = { - Encode : Base64Encode, - encode : Base64Encode, - Decode : Base64Decode, - decode : Base64Decode -}; - -},{"./lib/decode":4,"./lib/encode":5}],4:[function(require,module,exports){ -(function (Buffer){ -module.exports = Base64Decode; - -var Transform = require('stream').Transform || require('readable-stream').Transform; -require('util').inherits(Base64Decode, Transform); - -/** - * Decodes a Base64 data stream, coming in as a string or Buffer of UTF-8 text, into binary Buffers. - * @returns {Base64Decode} - * @constructor - */ -function Base64Decode() { - if ( !(this instanceof Base64Decode) ) - return new Base64Decode(); - - Transform.call(this, { - // The input is converted to strings, so no need to transform input strings to buffers - decodeStrings : false - }); - - // Any extra chars from the last chunk - this.extra = ''; -} - -/** - * Decodes a Base64 data stream, coming in as a string or Buffer of UTF-8 text, into binary Buffers. - * @param {Buffer|string} chunk - * @param encoding - * @param cb - * @private - */ -Base64Decode.prototype._transform = function (chunk, encoding, cb) { - // Convert chunk to a string - chunk = '' + chunk; - - // Add previous extra and remove any newline characters - chunk = this.extra + chunk.replace(/(\r\n|\n|\r)/gm, ''); - - // 4 characters represent 3 bytes, so we can only decode in groups of 4 chars - var remaining = chunk.length % 4; - - // Store the extra chars for later - this.extra = chunk.slice(chunk.length - remaining); - chunk = chunk.slice(0, chunk.length - remaining); - - // Create the new buffer and push - var buf = new Buffer(chunk, 'base64'); - this.push(buf); - cb(); -}; - -/** - * Emits 1, 2, or 3 extra characters of base64 data. - * @param cb - * @private - */ -Base64Decode.prototype._flush = function (cb) { - if ( this.extra.length ) - this.push(new Buffer(this.extra, 'base64')); - - cb(); -}; - -}).call(this,require("buffer").Buffer) -},{"buffer":10,"readable-stream":98,"stream":106,"util":114}],5:[function(require,module,exports){ -(function (Buffer){ -module.exports = Base64Encode; - -var Transform = require('stream').Transform || require('readable-stream').Transform; -require('util').inherits(Base64Encode, Transform); - -/** - * Transforms a Buffer stream of binary data to a stream of Base64 text. Note that this will - * also work on a stream of pure strings, as the Writeable base class will automatically decode - * text string chunks into Buffers. - * @returns {Base64Encode} - * @constructor - */ -function Base64Encode(lineLength) { - if ( !(this instanceof Base64Encode) ) - return new Base64Encode(lineLength); - - Transform.call(this); - - // Any extra chars from the last chunk - this.extra = null; - - this.lineLength = lineLength; - - this.currLineLength = 0; -} - -/** - * Adds \r\n as needed to the data chunk to ensure that the output Base64 string meets - * the maximum line length requirement. - * @param {string} chunk - * @returns {string} - * @private - */ -Base64Encode.prototype._fixLineLength = function (chunk) { - // If we care about line length, add line breaks - if ( !this.lineLength ) - return chunk; - - var size = chunk.length; - var needed = this.lineLength - this.currLineLength; - var start, end; - - var _chunk = ''; - for ( start = 0, end = needed; end < size; start = end, end += this.lineLength ) { - _chunk += chunk.slice(start, end); - _chunk += '\r\n'; - } - - var left = chunk.slice(start); - this.currLineLength = left.length; - - _chunk += left; - - return _chunk; -}; - -/** - * Transforms a Buffer chunk of data to a Base64 string chunk. - * @param {Buffer} chunk - * @param {string} encoding - unused since chunk is always a Buffer - * @param cb - * @private - */ -Base64Encode.prototype._transform = function (chunk, encoding, cb) { - // Add any previous extra bytes to the chunk - if ( this.extra ) { - chunk = Buffer.concat([this.extra, chunk]); - this.extra = null; - } - - // 3 bytes are represented by 4 characters, so we can only encode in groups of 3 bytes - var remaining = chunk.length % 3; - - if ( remaining !== 0 ) { - // Store the extra bytes for later - this.extra = chunk.slice(chunk.length - remaining); - chunk = chunk.slice(0, chunk.length - remaining); - } - - // Convert chunk to a base 64 string - chunk = chunk.toString('base64'); - - // Push the chunk - this.push(this._fixLineLength(chunk)); - cb(); -}; - -/** - * Emits 0 or 4 extra characters of Base64 data. - * @param cb - * @private - */ -Base64Encode.prototype._flush = function (cb) { - if ( this.extra ) - this.push(this._fixLineLength(this.extra.toString('base64'))); - - cb(); -}; - -}).call(this,require("buffer").Buffer) -},{"buffer":10,"readable-stream":98,"stream":106,"util":114}],6:[function(require,module,exports){ - -},{}],7:[function(require,module,exports){ +},{}],4:[function(require,module,exports){ (function (process,Buffer){ var msg = require('pako/lib/zlib/messages'); var zstream = require('pako/lib/zlib/zstream'); @@ -895,7 +717,7 @@ Zlib.prototype._error = function(status) { exports.Zlib = Zlib; }).call(this,require('_process'),require("buffer").Buffer) -},{"_process":87,"buffer":10,"pako/lib/zlib/constants":55,"pako/lib/zlib/deflate.js":57,"pako/lib/zlib/inflate.js":59,"pako/lib/zlib/messages":61,"pako/lib/zlib/zstream":63}],8:[function(require,module,exports){ +},{"_process":84,"buffer":7,"pako/lib/zlib/constants":52,"pako/lib/zlib/deflate.js":54,"pako/lib/zlib/inflate.js":56,"pako/lib/zlib/messages":58,"pako/lib/zlib/zstream":60}],5:[function(require,module,exports){ (function (process,Buffer){ // Copyright Joyent, Inc. and other Node contributors. // @@ -1509,9 +1331,9 @@ util.inherits(InflateRaw, Zlib); util.inherits(Unzip, Zlib); }).call(this,require('_process'),require("buffer").Buffer) -},{"./binding":7,"_process":87,"_stream_transform":99,"assert":1,"buffer":10,"util":114}],9:[function(require,module,exports){ -arguments[4][6][0].apply(exports,arguments) -},{"dup":6}],10:[function(require,module,exports){ +},{"./binding":4,"_process":84,"_stream_transform":96,"assert":1,"buffer":7,"util":111}],6:[function(require,module,exports){ +arguments[4][3][0].apply(exports,arguments) +},{"dup":3}],7:[function(require,module,exports){ (function (global){ /*! * The buffer module from node.js, for the browser. @@ -3304,14 +3126,14 @@ function isnan (val) { } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"base64-js":2,"ieee754":39,"isarray":11}],11:[function(require,module,exports){ +},{"base64-js":2,"ieee754":36,"isarray":8}],8:[function(require,module,exports){ var toString = {}.toString; module.exports = Array.isArray || function (arr) { return toString.call(arr) == '[object Array]'; }; -},{}],12:[function(require,module,exports){ +},{}],9:[function(require,module,exports){ (function (Buffer){ /**! * contentstream - index.js @@ -3360,12 +3182,12 @@ ContentStream.prototype._read = function (n) { }; }).call(this,require("buffer").Buffer) -},{"buffer":10,"readable-stream":19,"util":114}],13:[function(require,module,exports){ +},{"buffer":7,"readable-stream":16,"util":111}],10:[function(require,module,exports){ module.exports = Array.isArray || function (arr) { return Object.prototype.toString.call(arr) == '[object Array]'; }; -},{}],14:[function(require,module,exports){ +},{}],11:[function(require,module,exports){ (function (process){ // Copyright Joyent, Inc. and other Node contributors. // @@ -3458,7 +3280,7 @@ function forEach (xs, f) { } }).call(this,require('_process')) -},{"./_stream_readable":16,"./_stream_writable":18,"_process":87,"core-util-is":21,"inherits":40}],15:[function(require,module,exports){ +},{"./_stream_readable":13,"./_stream_writable":15,"_process":84,"core-util-is":18,"inherits":37}],12:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -3506,7 +3328,7 @@ PassThrough.prototype._transform = function(chunk, encoding, cb) { cb(null, chunk); }; -},{"./_stream_transform":17,"core-util-is":21,"inherits":40}],16:[function(require,module,exports){ +},{"./_stream_transform":14,"core-util-is":18,"inherits":37}],13:[function(require,module,exports){ (function (process){ // Copyright Joyent, Inc. and other Node contributors. // @@ -4492,7 +4314,7 @@ function indexOf (xs, x) { } }).call(this,require('_process')) -},{"_process":87,"buffer":10,"core-util-is":21,"events":26,"inherits":40,"isarray":13,"stream":106,"string_decoder/":20}],17:[function(require,module,exports){ +},{"_process":84,"buffer":7,"core-util-is":18,"events":23,"inherits":37,"isarray":10,"stream":103,"string_decoder/":17}],14:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -4704,7 +4526,7 @@ function done(stream, er) { return stream.push(null); } -},{"./_stream_duplex":14,"core-util-is":21,"inherits":40}],18:[function(require,module,exports){ +},{"./_stream_duplex":11,"core-util-is":18,"inherits":37}],15:[function(require,module,exports){ (function (process){ // Copyright Joyent, Inc. and other Node contributors. // @@ -5094,7 +4916,7 @@ function endWritable(stream, state, cb) { } }).call(this,require('_process')) -},{"./_stream_duplex":14,"_process":87,"buffer":10,"core-util-is":21,"inherits":40,"stream":106}],19:[function(require,module,exports){ +},{"./_stream_duplex":11,"_process":84,"buffer":7,"core-util-is":18,"inherits":37,"stream":103}],16:[function(require,module,exports){ (function (process){ var Stream = require('stream'); // hack to fix a circular dependency issue when used with browserify exports = module.exports = require('./lib/_stream_readable.js'); @@ -5109,7 +4931,7 @@ if (!process.browser && process.env.READABLE_STREAM === 'disable') { } }).call(this,require('_process')) -},{"./lib/_stream_duplex.js":14,"./lib/_stream_passthrough.js":15,"./lib/_stream_readable.js":16,"./lib/_stream_transform.js":17,"./lib/_stream_writable.js":18,"_process":87,"stream":106}],20:[function(require,module,exports){ +},{"./lib/_stream_duplex.js":11,"./lib/_stream_passthrough.js":12,"./lib/_stream_readable.js":13,"./lib/_stream_transform.js":14,"./lib/_stream_writable.js":15,"_process":84,"stream":103}],17:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -5332,7 +5154,7 @@ function base64DetectIncompleteChar(buffer) { this.charLength = this.charReceived ? 3 : 0; } -},{"buffer":10}],21:[function(require,module,exports){ +},{"buffer":7}],18:[function(require,module,exports){ (function (Buffer){ // Copyright Joyent, Inc. and other Node contributors. // @@ -5443,7 +5265,7 @@ function objectToString(o) { } }).call(this,{"isBuffer":require("../../is-buffer/index.js")}) -},{"../../is-buffer/index.js":42}],22:[function(require,module,exports){ +},{"../../is-buffer/index.js":39}],19:[function(require,module,exports){ "use strict" var createThunk = require("./lib/thunk.js") @@ -5554,7 +5376,7 @@ function compileCwise(user_args) { module.exports = compileCwise -},{"./lib/thunk.js":24}],23:[function(require,module,exports){ +},{"./lib/thunk.js":21}],20:[function(require,module,exports){ "use strict" var uniq = require("uniq") @@ -5914,7 +5736,7 @@ function generateCWiseOp(proc, typesig) { } module.exports = generateCWiseOp -},{"uniq":109}],24:[function(require,module,exports){ +},{"uniq":106}],21:[function(require,module,exports){ "use strict" // The function below is called when constructing a cwise function object, and does the following: @@ -6002,7 +5824,7 @@ function createThunk(proc) { module.exports = createThunk -},{"./compile.js":23}],25:[function(require,module,exports){ +},{"./compile.js":20}],22:[function(require,module,exports){ (function (Buffer){ /** @@ -6060,7 +5882,7 @@ function dataUriToBuffer (uri) { } }).call(this,require("buffer").Buffer) -},{"buffer":10}],26:[function(require,module,exports){ +},{"buffer":7}],23:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -6364,7 +6186,7 @@ function isUndefined(arg) { return arg === void 0; } -},{}],27:[function(require,module,exports){ +},{}],24:[function(require,module,exports){ (function (Buffer,process){ 'use strict' @@ -6502,7 +6324,7 @@ module.exports = function getPixels(url, type, cb) { } } }).call(this,{"isBuffer":require("../is-buffer/index.js")},require('_process')) -},{"../is-buffer/index.js":42,"_process":87,"data-uri-to-buffer":25,"ndarray":51,"ndarray-pack":49,"omggif":52,"path":64,"through":108}],28:[function(require,module,exports){ +},{"../is-buffer/index.js":39,"_process":84,"data-uri-to-buffer":22,"ndarray":48,"ndarray-pack":46,"omggif":49,"path":61,"through":105}],25:[function(require,module,exports){ (function (Buffer){ /* GIFEncoder.js @@ -6975,7 +6797,7 @@ GIFEncoder.ByteCapacitor = ByteCapacitor; module.exports = GIFEncoder; }).call(this,require("buffer").Buffer) -},{"./LZWEncoder.js":29,"./TypedNeuQuant.js":30,"assert":1,"buffer":10,"events":26,"readable-stream":37,"util":114}],29:[function(require,module,exports){ +},{"./LZWEncoder.js":26,"./TypedNeuQuant.js":27,"assert":1,"buffer":7,"events":23,"readable-stream":34,"util":111}],26:[function(require,module,exports){ /* LZWEncoder.js @@ -7189,7 +7011,7 @@ function LZWEncoder(width, height, pixels, colorDepth) { module.exports = LZWEncoder; -},{}],30:[function(require,module,exports){ +},{}],27:[function(require,module,exports){ /* NeuQuant Neural-Net Quantization Algorithm * ------------------------------------------ * @@ -7622,13 +7444,13 @@ function NeuQuant(pixels, samplefac) { module.exports = NeuQuant; -},{}],31:[function(require,module,exports){ -arguments[4][13][0].apply(exports,arguments) -},{"dup":13}],32:[function(require,module,exports){ -arguments[4][14][0].apply(exports,arguments) -},{"./_stream_readable":34,"./_stream_writable":36,"_process":87,"core-util-is":21,"dup":14,"inherits":40}],33:[function(require,module,exports){ -arguments[4][15][0].apply(exports,arguments) -},{"./_stream_transform":35,"core-util-is":21,"dup":15,"inherits":40}],34:[function(require,module,exports){ +},{}],28:[function(require,module,exports){ +arguments[4][10][0].apply(exports,arguments) +},{"dup":10}],29:[function(require,module,exports){ +arguments[4][11][0].apply(exports,arguments) +},{"./_stream_readable":31,"./_stream_writable":33,"_process":84,"core-util-is":18,"dup":11,"inherits":37}],30:[function(require,module,exports){ +arguments[4][12][0].apply(exports,arguments) +},{"./_stream_transform":32,"core-util-is":18,"dup":12,"inherits":37}],31:[function(require,module,exports){ (function (process){ // Copyright Joyent, Inc. and other Node contributors. // @@ -8583,7 +8405,7 @@ function indexOf (xs, x) { } }).call(this,require('_process')) -},{"./_stream_duplex":32,"_process":87,"buffer":10,"core-util-is":21,"events":26,"inherits":40,"isarray":31,"stream":106,"string_decoder/":38,"util":6}],35:[function(require,module,exports){ +},{"./_stream_duplex":29,"_process":84,"buffer":7,"core-util-is":18,"events":23,"inherits":37,"isarray":28,"stream":103,"string_decoder/":35,"util":3}],32:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -8794,7 +8616,7 @@ function done(stream, er) { return stream.push(null); } -},{"./_stream_duplex":32,"core-util-is":21,"inherits":40}],36:[function(require,module,exports){ +},{"./_stream_duplex":29,"core-util-is":18,"inherits":37}],33:[function(require,module,exports){ (function (process){ // Copyright Joyent, Inc. and other Node contributors. // @@ -9275,7 +9097,7 @@ function endWritable(stream, state, cb) { } }).call(this,require('_process')) -},{"./_stream_duplex":32,"_process":87,"buffer":10,"core-util-is":21,"inherits":40,"stream":106}],37:[function(require,module,exports){ +},{"./_stream_duplex":29,"_process":84,"buffer":7,"core-util-is":18,"inherits":37,"stream":103}],34:[function(require,module,exports){ (function (process){ exports = module.exports = require('./lib/_stream_readable.js'); exports.Stream = require('stream'); @@ -9289,9 +9111,9 @@ if (!process.browser && process.env.READABLE_STREAM === 'disable') { } }).call(this,require('_process')) -},{"./lib/_stream_duplex.js":32,"./lib/_stream_passthrough.js":33,"./lib/_stream_readable.js":34,"./lib/_stream_transform.js":35,"./lib/_stream_writable.js":36,"_process":87,"stream":106}],38:[function(require,module,exports){ -arguments[4][20][0].apply(exports,arguments) -},{"buffer":10,"dup":20}],39:[function(require,module,exports){ +},{"./lib/_stream_duplex.js":29,"./lib/_stream_passthrough.js":30,"./lib/_stream_readable.js":31,"./lib/_stream_transform.js":32,"./lib/_stream_writable.js":33,"_process":84,"stream":103}],35:[function(require,module,exports){ +arguments[4][17][0].apply(exports,arguments) +},{"buffer":7,"dup":17}],36:[function(require,module,exports){ exports.read = function (buffer, offset, isLE, mLen, nBytes) { var e, m var eLen = nBytes * 8 - mLen - 1 @@ -9377,7 +9199,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) { buffer[offset + i - d] |= s * 128 } -},{}],40:[function(require,module,exports){ +},{}],37:[function(require,module,exports){ if (typeof Object.create === 'function') { // implementation from standard node.js 'util' module module.exports = function inherits(ctor, superCtor) { @@ -9402,7 +9224,7 @@ if (typeof Object.create === 'function') { } } -},{}],41:[function(require,module,exports){ +},{}],38:[function(require,module,exports){ "use strict" function iota(n) { @@ -9414,7 +9236,7 @@ function iota(n) { } module.exports = iota -},{}],42:[function(require,module,exports){ +},{}],39:[function(require,module,exports){ /*! * Determine if an object is a Buffer * @@ -9437,9 +9259,9 @@ function isSlowBuffer (obj) { return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0)) } -},{}],43:[function(require,module,exports){ -arguments[4][11][0].apply(exports,arguments) -},{"dup":11}],44:[function(require,module,exports){ +},{}],40:[function(require,module,exports){ +arguments[4][8][0].apply(exports,arguments) +},{"dup":8}],41:[function(require,module,exports){ /*! * jQuery JavaScript Library v2.2.4 * http://jquery.com/ @@ -19255,7 +19077,7 @@ if ( !noGlobal ) { return jQuery; })); -},{}],45:[function(require,module,exports){ +},{}],42:[function(require,module,exports){ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); @@ -21981,7 +21803,7 @@ return /******/ (function(modules) { // webpackBootstrap /******/ ]) }); ; -},{}],46:[function(require,module,exports){ +},{}],43:[function(require,module,exports){ (function (process){ var path = require('path'); var fs = require('fs'); @@ -22093,10 +21915,10 @@ mime.charsets = { module.exports = mime; }).call(this,require('_process')) -},{"./types.json":47,"_process":87,"fs":9,"path":64}],47:[function(require,module,exports){ +},{"./types.json":44,"_process":84,"fs":6,"path":61}],44:[function(require,module,exports){ module.exports={"application/andrew-inset":["ez"],"application/applixware":["aw"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomsvc+xml":["atomsvc"],"application/bdoc":["bdoc"],"application/ccxml+xml":["ccxml"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cu-seeme":["cu"],"application/dash+xml":["mpd"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["ecma"],"application/emma+xml":["emma"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/font-tdpfr":["pfr"],"application/font-woff":["woff"],"application/font-woff2":["woff2"],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["js"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["mp4s","m4p"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/patch-ops-error+xml":["xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-signature":["asc","sig"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/prs.cww":["cww"],"application/pskc+xml":["pskcxml"],"application/rdf+xml":["rdf"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/vnd.3gpp.pic-bw-large":["plb"],"application/vnd.3gpp.pic-bw-small":["psb"],"application/vnd.3gpp.pic-bw-var":["pvb"],"application/vnd.3gpp2.tcap":["tcap"],"application/vnd.3m.post-it-notes":["pwn"],"application/vnd.accpac.simply.aso":["aso"],"application/vnd.accpac.simply.imp":["imp"],"application/vnd.acucobol":["acu"],"application/vnd.acucorp":["atc","acutc"],"application/vnd.adobe.air-application-installer-package+zip":["air"],"application/vnd.adobe.formscentral.fcdt":["fcdt"],"application/vnd.adobe.fxp":["fxp","fxpl"],"application/vnd.adobe.xdp+xml":["xdp"],"application/vnd.adobe.xfdf":["xfdf"],"application/vnd.ahead.space":["ahead"],"application/vnd.airzip.filesecure.azf":["azf"],"application/vnd.airzip.filesecure.azs":["azs"],"application/vnd.amazon.ebook":["azw"],"application/vnd.americandynamics.acc":["acc"],"application/vnd.amiga.ami":["ami"],"application/vnd.android.package-archive":["apk"],"application/vnd.anser-web-certificate-issue-initiation":["cii"],"application/vnd.anser-web-funds-transfer-initiation":["fti"],"application/vnd.antix.game-component":["atx"],"application/vnd.apple.installer+xml":["mpkg"],"application/vnd.apple.mpegurl":["m3u8"],"application/vnd.apple.pkpass":["pkpass"],"application/vnd.aristanetworks.swi":["swi"],"application/vnd.astraea-software.iota":["iota"],"application/vnd.audiograph":["aep"],"application/vnd.blueice.multipass":["mpm"],"application/vnd.bmi":["bmi"],"application/vnd.businessobjects":["rep"],"application/vnd.chemdraw+xml":["cdxml"],"application/vnd.chipnuts.karaoke-mmd":["mmd"],"application/vnd.cinderella":["cdy"],"application/vnd.claymore":["cla"],"application/vnd.cloanto.rp9":["rp9"],"application/vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"application/vnd.cluetrust.cartomobile-config":["c11amc"],"application/vnd.cluetrust.cartomobile-config-pkg":["c11amz"],"application/vnd.commonspace":["csp"],"application/vnd.contact.cmsg":["cdbcmsg"],"application/vnd.cosmocaller":["cmc"],"application/vnd.crick.clicker":["clkx"],"application/vnd.crick.clicker.keyboard":["clkk"],"application/vnd.crick.clicker.palette":["clkp"],"application/vnd.crick.clicker.template":["clkt"],"application/vnd.crick.clicker.wordbank":["clkw"],"application/vnd.criticaltools.wbs+xml":["wbs"],"application/vnd.ctc-posml":["pml"],"application/vnd.cups-ppd":["ppd"],"application/vnd.curl.car":["car"],"application/vnd.curl.pcurl":["pcurl"],"application/vnd.dart":["dart"],"application/vnd.data-vision.rdz":["rdz"],"application/vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"application/vnd.dece.ttml+xml":["uvt","uvvt"],"application/vnd.dece.unspecified":["uvx","uvvx"],"application/vnd.dece.zip":["uvz","uvvz"],"application/vnd.denovo.fcselayout-link":["fe_launch"],"application/vnd.dna":["dna"],"application/vnd.dolby.mlp":["mlp"],"application/vnd.dpgraph":["dpg"],"application/vnd.dreamfactory":["dfac"],"application/vnd.ds-keypoint":["kpxx"],"application/vnd.dvb.ait":["ait"],"application/vnd.dvb.service":["svc"],"application/vnd.dynageo":["geo"],"application/vnd.ecowin.chart":["mag"],"application/vnd.enliven":["nml"],"application/vnd.epson.esf":["esf"],"application/vnd.epson.msf":["msf"],"application/vnd.epson.quickanime":["qam"],"application/vnd.epson.salt":["slt"],"application/vnd.epson.ssf":["ssf"],"application/vnd.eszigno3+xml":["es3","et3"],"application/vnd.ezpix-album":["ez2"],"application/vnd.ezpix-package":["ez3"],"application/vnd.fdf":["fdf"],"application/vnd.fdsn.mseed":["mseed"],"application/vnd.fdsn.seed":["seed","dataless"],"application/vnd.flographit":["gph"],"application/vnd.fluxtime.clip":["ftc"],"application/vnd.framemaker":["fm","frame","maker","book"],"application/vnd.frogans.fnc":["fnc"],"application/vnd.frogans.ltf":["ltf"],"application/vnd.fsc.weblaunch":["fsc"],"application/vnd.fujitsu.oasys":["oas"],"application/vnd.fujitsu.oasys2":["oa2"],"application/vnd.fujitsu.oasys3":["oa3"],"application/vnd.fujitsu.oasysgp":["fg5"],"application/vnd.fujitsu.oasysprs":["bh2"],"application/vnd.fujixerox.ddd":["ddd"],"application/vnd.fujixerox.docuworks":["xdw"],"application/vnd.fujixerox.docuworks.binder":["xbd"],"application/vnd.fuzzysheet":["fzs"],"application/vnd.genomatix.tuxedo":["txd"],"application/vnd.geogebra.file":["ggb"],"application/vnd.geogebra.tool":["ggt"],"application/vnd.geometry-explorer":["gex","gre"],"application/vnd.geonext":["gxt"],"application/vnd.geoplan":["g2w"],"application/vnd.geospace":["g3w"],"application/vnd.gmx":["gmx"],"application/vnd.google-apps.document":["gdoc"],"application/vnd.google-apps.presentation":["gslides"],"application/vnd.google-apps.spreadsheet":["gsheet"],"application/vnd.google-earth.kml+xml":["kml"],"application/vnd.google-earth.kmz":["kmz"],"application/vnd.grafeq":["gqf","gqs"],"application/vnd.groove-account":["gac"],"application/vnd.groove-help":["ghf"],"application/vnd.groove-identity-message":["gim"],"application/vnd.groove-injector":["grv"],"application/vnd.groove-tool-message":["gtm"],"application/vnd.groove-tool-template":["tpl"],"application/vnd.groove-vcard":["vcg"],"application/vnd.hal+xml":["hal"],"application/vnd.handheld-entertainment+xml":["zmm"],"application/vnd.hbci":["hbci"],"application/vnd.hhe.lesson-player":["les"],"application/vnd.hp-hpgl":["hpgl"],"application/vnd.hp-hpid":["hpid"],"application/vnd.hp-hps":["hps"],"application/vnd.hp-jlyt":["jlt"],"application/vnd.hp-pcl":["pcl"],"application/vnd.hp-pclxl":["pclxl"],"application/vnd.hydrostatix.sof-data":["sfd-hdstx"],"application/vnd.ibm.minipay":["mpy"],"application/vnd.ibm.modcap":["afp","listafp","list3820"],"application/vnd.ibm.rights-management":["irm"],"application/vnd.ibm.secure-container":["sc"],"application/vnd.iccprofile":["icc","icm"],"application/vnd.igloader":["igl"],"application/vnd.immervision-ivp":["ivp"],"application/vnd.immervision-ivu":["ivu"],"application/vnd.insors.igm":["igm"],"application/vnd.intercon.formnet":["xpw","xpx"],"application/vnd.intergeo":["i2g"],"application/vnd.intu.qbo":["qbo"],"application/vnd.intu.qfx":["qfx"],"application/vnd.ipunplugged.rcprofile":["rcprofile"],"application/vnd.irepository.package+xml":["irp"],"application/vnd.is-xpr":["xpr"],"application/vnd.isac.fcs":["fcs"],"application/vnd.jam":["jam"],"application/vnd.jcp.javame.midlet-rms":["rms"],"application/vnd.jisp":["jisp"],"application/vnd.joost.joda-archive":["joda"],"application/vnd.kahootz":["ktz","ktr"],"application/vnd.kde.karbon":["karbon"],"application/vnd.kde.kchart":["chrt"],"application/vnd.kde.kformula":["kfo"],"application/vnd.kde.kivio":["flw"],"application/vnd.kde.kontour":["kon"],"application/vnd.kde.kpresenter":["kpr","kpt"],"application/vnd.kde.kspread":["ksp"],"application/vnd.kde.kword":["kwd","kwt"],"application/vnd.kenameaapp":["htke"],"application/vnd.kidspiration":["kia"],"application/vnd.kinar":["kne","knp"],"application/vnd.koan":["skp","skd","skt","skm"],"application/vnd.kodak-descriptor":["sse"],"application/vnd.las.las+xml":["lasxml"],"application/vnd.llamagraphics.life-balance.desktop":["lbd"],"application/vnd.llamagraphics.life-balance.exchange+xml":["lbe"],"application/vnd.lotus-1-2-3":["123"],"application/vnd.lotus-approach":["apr"],"application/vnd.lotus-freelance":["pre"],"application/vnd.lotus-notes":["nsf"],"application/vnd.lotus-organizer":["org"],"application/vnd.lotus-screencam":["scm"],"application/vnd.lotus-wordpro":["lwp"],"application/vnd.macports.portpkg":["portpkg"],"application/vnd.mcd":["mcd"],"application/vnd.medcalcdata":["mc1"],"application/vnd.mediastation.cdkey":["cdkey"],"application/vnd.mfer":["mwf"],"application/vnd.mfmp":["mfm"],"application/vnd.micrografx.flo":["flo"],"application/vnd.micrografx.igx":["igx"],"application/vnd.mif":["mif"],"application/vnd.mobius.daf":["daf"],"application/vnd.mobius.dis":["dis"],"application/vnd.mobius.mbk":["mbk"],"application/vnd.mobius.mqy":["mqy"],"application/vnd.mobius.msl":["msl"],"application/vnd.mobius.plc":["plc"],"application/vnd.mobius.txf":["txf"],"application/vnd.mophun.application":["mpn"],"application/vnd.mophun.certificate":["mpc"],"application/vnd.mozilla.xul+xml":["xul"],"application/vnd.ms-artgalry":["cil"],"application/vnd.ms-cab-compressed":["cab"],"application/vnd.ms-excel":["xls","xlm","xla","xlc","xlt","xlw"],"application/vnd.ms-excel.addin.macroenabled.12":["xlam"],"application/vnd.ms-excel.sheet.binary.macroenabled.12":["xlsb"],"application/vnd.ms-excel.sheet.macroenabled.12":["xlsm"],"application/vnd.ms-excel.template.macroenabled.12":["xltm"],"application/vnd.ms-fontobject":["eot"],"application/vnd.ms-htmlhelp":["chm"],"application/vnd.ms-ims":["ims"],"application/vnd.ms-lrm":["lrm"],"application/vnd.ms-officetheme":["thmx"],"application/vnd.ms-pki.seccat":["cat"],"application/vnd.ms-pki.stl":["stl"],"application/vnd.ms-powerpoint":["ppt","pps","pot"],"application/vnd.ms-powerpoint.addin.macroenabled.12":["ppam"],"application/vnd.ms-powerpoint.presentation.macroenabled.12":["pptm"],"application/vnd.ms-powerpoint.slide.macroenabled.12":["sldm"],"application/vnd.ms-powerpoint.slideshow.macroenabled.12":["ppsm"],"application/vnd.ms-powerpoint.template.macroenabled.12":["potm"],"application/vnd.ms-project":["mpp","mpt"],"application/vnd.ms-word.document.macroenabled.12":["docm"],"application/vnd.ms-word.template.macroenabled.12":["dotm"],"application/vnd.ms-works":["wps","wks","wcm","wdb"],"application/vnd.ms-wpl":["wpl"],"application/vnd.ms-xpsdocument":["xps"],"application/vnd.mseq":["mseq"],"application/vnd.musician":["mus"],"application/vnd.muvee.style":["msty"],"application/vnd.mynfc":["taglet"],"application/vnd.neurolanguage.nlu":["nlu"],"application/vnd.nitf":["ntf","nitf"],"application/vnd.noblenet-directory":["nnd"],"application/vnd.noblenet-sealer":["nns"],"application/vnd.noblenet-web":["nnw"],"application/vnd.nokia.n-gage.data":["ngdat"],"application/vnd.nokia.n-gage.symbian.install":["n-gage"],"application/vnd.nokia.radio-preset":["rpst"],"application/vnd.nokia.radio-presets":["rpss"],"application/vnd.novadigm.edm":["edm"],"application/vnd.novadigm.edx":["edx"],"application/vnd.novadigm.ext":["ext"],"application/vnd.oasis.opendocument.chart":["odc"],"application/vnd.oasis.opendocument.chart-template":["otc"],"application/vnd.oasis.opendocument.database":["odb"],"application/vnd.oasis.opendocument.formula":["odf"],"application/vnd.oasis.opendocument.formula-template":["odft"],"application/vnd.oasis.opendocument.graphics":["odg"],"application/vnd.oasis.opendocument.graphics-template":["otg"],"application/vnd.oasis.opendocument.image":["odi"],"application/vnd.oasis.opendocument.image-template":["oti"],"application/vnd.oasis.opendocument.presentation":["odp"],"application/vnd.oasis.opendocument.presentation-template":["otp"],"application/vnd.oasis.opendocument.spreadsheet":["ods"],"application/vnd.oasis.opendocument.spreadsheet-template":["ots"],"application/vnd.oasis.opendocument.text":["odt"],"application/vnd.oasis.opendocument.text-master":["odm"],"application/vnd.oasis.opendocument.text-template":["ott"],"application/vnd.oasis.opendocument.text-web":["oth"],"application/vnd.olpc-sugar":["xo"],"application/vnd.oma.dd2+xml":["dd2"],"application/vnd.openofficeorg.extension":["oxt"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":["pptx"],"application/vnd.openxmlformats-officedocument.presentationml.slide":["sldx"],"application/vnd.openxmlformats-officedocument.presentationml.slideshow":["ppsx"],"application/vnd.openxmlformats-officedocument.presentationml.template":["potx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":["xlsx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.template":["xltx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":["docx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.template":["dotx"],"application/vnd.osgeo.mapguide.package":["mgp"],"application/vnd.osgi.dp":["dp"],"application/vnd.osgi.subsystem":["esa"],"application/vnd.palm":["pdb","pqa","oprc"],"application/vnd.pawaafile":["paw"],"application/vnd.pg.format":["str"],"application/vnd.pg.osasli":["ei6"],"application/vnd.picsel":["efif"],"application/vnd.pmi.widget":["wg"],"application/vnd.pocketlearn":["plf"],"application/vnd.powerbuilder6":["pbd"],"application/vnd.previewsystems.box":["box"],"application/vnd.proteus.magazine":["mgz"],"application/vnd.publishare-delta-tree":["qps"],"application/vnd.pvi.ptid1":["ptid"],"application/vnd.quark.quarkxpress":["qxd","qxt","qwd","qwt","qxl","qxb"],"application/vnd.realvnc.bed":["bed"],"application/vnd.recordare.musicxml":["mxl"],"application/vnd.recordare.musicxml+xml":["musicxml"],"application/vnd.rig.cryptonote":["cryptonote"],"application/vnd.rim.cod":["cod"],"application/vnd.rn-realmedia":["rm"],"application/vnd.rn-realmedia-vbr":["rmvb"],"application/vnd.route66.link66+xml":["link66"],"application/vnd.sailingtracker.track":["st"],"application/vnd.seemail":["see"],"application/vnd.sema":["sema"],"application/vnd.semd":["semd"],"application/vnd.semf":["semf"],"application/vnd.shana.informed.formdata":["ifm"],"application/vnd.shana.informed.formtemplate":["itp"],"application/vnd.shana.informed.interchange":["iif"],"application/vnd.shana.informed.package":["ipk"],"application/vnd.simtech-mindmapper":["twd","twds"],"application/vnd.smaf":["mmf"],"application/vnd.smart.teacher":["teacher"],"application/vnd.solent.sdkm+xml":["sdkm","sdkd"],"application/vnd.spotfire.dxp":["dxp"],"application/vnd.spotfire.sfs":["sfs"],"application/vnd.stardivision.calc":["sdc"],"application/vnd.stardivision.draw":["sda"],"application/vnd.stardivision.impress":["sdd"],"application/vnd.stardivision.math":["smf"],"application/vnd.stardivision.writer":["sdw","vor"],"application/vnd.stardivision.writer-global":["sgl"],"application/vnd.stepmania.package":["smzip"],"application/vnd.stepmania.stepchart":["sm"],"application/vnd.sun.xml.calc":["sxc"],"application/vnd.sun.xml.calc.template":["stc"],"application/vnd.sun.xml.draw":["sxd"],"application/vnd.sun.xml.draw.template":["std"],"application/vnd.sun.xml.impress":["sxi"],"application/vnd.sun.xml.impress.template":["sti"],"application/vnd.sun.xml.math":["sxm"],"application/vnd.sun.xml.writer":["sxw"],"application/vnd.sun.xml.writer.global":["sxg"],"application/vnd.sun.xml.writer.template":["stw"],"application/vnd.sus-calendar":["sus","susp"],"application/vnd.svd":["svd"],"application/vnd.symbian.install":["sis","sisx"],"application/vnd.syncml+xml":["xsm"],"application/vnd.syncml.dm+wbxml":["bdm"],"application/vnd.syncml.dm+xml":["xdm"],"application/vnd.tao.intent-module-archive":["tao"],"application/vnd.tcpdump.pcap":["pcap","cap","dmp"],"application/vnd.tmobile-livetv":["tmo"],"application/vnd.trid.tpt":["tpt"],"application/vnd.triscape.mxs":["mxs"],"application/vnd.trueapp":["tra"],"application/vnd.ufdl":["ufd","ufdl"],"application/vnd.uiq.theme":["utz"],"application/vnd.umajin":["umj"],"application/vnd.unity":["unityweb"],"application/vnd.uoml+xml":["uoml"],"application/vnd.vcx":["vcx"],"application/vnd.visio":["vsd","vst","vss","vsw"],"application/vnd.visionary":["vis"],"application/vnd.vsf":["vsf"],"application/vnd.wap.wbxml":["wbxml"],"application/vnd.wap.wmlc":["wmlc"],"application/vnd.wap.wmlscriptc":["wmlsc"],"application/vnd.webturbo":["wtb"],"application/vnd.wolfram.player":["nbp"],"application/vnd.wordperfect":["wpd"],"application/vnd.wqd":["wqd"],"application/vnd.wt.stf":["stf"],"application/vnd.xara":["xar"],"application/vnd.xfdl":["xfdl"],"application/vnd.yamaha.hv-dic":["hvd"],"application/vnd.yamaha.hv-script":["hvs"],"application/vnd.yamaha.hv-voice":["hvp"],"application/vnd.yamaha.openscoreformat":["osf"],"application/vnd.yamaha.openscoreformat.osfpvg+xml":["osfpvg"],"application/vnd.yamaha.smaf-audio":["saf"],"application/vnd.yamaha.smaf-phrase":["spf"],"application/vnd.yellowriver-custom-menu":["cmp"],"application/vnd.zul":["zir","zirz"],"application/vnd.zzazz.deck+xml":["zaz"],"application/voicexml+xml":["vxml"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/x-7z-compressed":["7z"],"application/x-abiword":["abw"],"application/x-ace-compressed":["ace"],"application/x-apple-diskimage":["dmg"],"application/x-authorware-bin":["aab","x32","u32","vox"],"application/x-authorware-map":["aam"],"application/x-authorware-seg":["aas"],"application/x-bcpio":["bcpio"],"application/x-bdoc":["bdoc"],"application/x-bittorrent":["torrent"],"application/x-blorb":["blb","blorb"],"application/x-bzip":["bz"],"application/x-bzip2":["bz2","boz"],"application/x-cbr":["cbr","cba","cbt","cbz","cb7"],"application/x-cdlink":["vcd"],"application/x-cfs-compressed":["cfs"],"application/x-chat":["chat"],"application/x-chess-pgn":["pgn"],"application/x-chrome-extension":["crx"],"application/x-cocoa":["cco"],"application/x-conference":["nsc"],"application/x-cpio":["cpio"],"application/x-csh":["csh"],"application/x-debian-package":["deb","udeb"],"application/x-dgc-compressed":["dgc"],"application/x-director":["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"],"application/x-doom":["wad"],"application/x-dtbncx+xml":["ncx"],"application/x-dtbook+xml":["dtb"],"application/x-dtbresource+xml":["res"],"application/x-dvi":["dvi"],"application/x-envoy":["evy"],"application/x-eva":["eva"],"application/x-font-bdf":["bdf"],"application/x-font-ghostscript":["gsf"],"application/x-font-linux-psf":["psf"],"application/x-font-otf":["otf"],"application/x-font-pcf":["pcf"],"application/x-font-snf":["snf"],"application/x-font-ttf":["ttf","ttc"],"application/x-font-type1":["pfa","pfb","pfm","afm"],"application/x-freearc":["arc"],"application/x-futuresplash":["spl"],"application/x-gca-compressed":["gca"],"application/x-glulx":["ulx"],"application/x-gnumeric":["gnumeric"],"application/x-gramps-xml":["gramps"],"application/x-gtar":["gtar"],"application/x-hdf":["hdf"],"application/x-httpd-php":["php"],"application/x-install-instructions":["install"],"application/x-iso9660-image":["iso"],"application/x-java-archive-diff":["jardiff"],"application/x-java-jnlp-file":["jnlp"],"application/x-latex":["latex"],"application/x-lua-bytecode":["luac"],"application/x-lzh-compressed":["lzh","lha"],"application/x-makeself":["run"],"application/x-mie":["mie"],"application/x-mobipocket-ebook":["prc","mobi"],"application/x-ms-application":["application"],"application/x-ms-shortcut":["lnk"],"application/x-ms-wmd":["wmd"],"application/x-ms-wmz":["wmz"],"application/x-ms-xbap":["xbap"],"application/x-msaccess":["mdb"],"application/x-msbinder":["obd"],"application/x-mscardfile":["crd"],"application/x-msclip":["clp"],"application/x-msdos-program":["exe"],"application/x-msdownload":["exe","dll","com","bat","msi"],"application/x-msmediaview":["mvb","m13","m14"],"application/x-msmetafile":["wmf","wmz","emf","emz"],"application/x-msmoney":["mny"],"application/x-mspublisher":["pub"],"application/x-msschedule":["scd"],"application/x-msterminal":["trm"],"application/x-mswrite":["wri"],"application/x-netcdf":["nc","cdf"],"application/x-ns-proxy-autoconfig":["pac"],"application/x-nzb":["nzb"],"application/x-perl":["pl","pm"],"application/x-pilot":["prc","pdb"],"application/x-pkcs12":["p12","pfx"],"application/x-pkcs7-certificates":["p7b","spc"],"application/x-pkcs7-certreqresp":["p7r"],"application/x-rar-compressed":["rar"],"application/x-redhat-package-manager":["rpm"],"application/x-research-info-systems":["ris"],"application/x-sea":["sea"],"application/x-sh":["sh"],"application/x-shar":["shar"],"application/x-shockwave-flash":["swf"],"application/x-silverlight-app":["xap"],"application/x-sql":["sql"],"application/x-stuffit":["sit"],"application/x-stuffitx":["sitx"],"application/x-subrip":["srt"],"application/x-sv4cpio":["sv4cpio"],"application/x-sv4crc":["sv4crc"],"application/x-t3vm-image":["t3"],"application/x-tads":["gam"],"application/x-tar":["tar"],"application/x-tcl":["tcl","tk"],"application/x-tex":["tex"],"application/x-tex-tfm":["tfm"],"application/x-texinfo":["texinfo","texi"],"application/x-tgif":["obj"],"application/x-ustar":["ustar"],"application/x-wais-source":["src"],"application/x-web-app-manifest+json":["webapp"],"application/x-x509-ca-cert":["der","crt","pem"],"application/x-xfig":["fig"],"application/x-xliff+xml":["xlf"],"application/x-xpinstall":["xpi"],"application/x-xz":["xz"],"application/x-zmachine":["z1","z2","z3","z4","z5","z6","z7","z8"],"application/xaml+xml":["xaml"],"application/xcap-diff+xml":["xdf"],"application/xenc+xml":["xenc"],"application/xhtml+xml":["xhtml","xht"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/3gpp":["3gpp"],"audio/adpcm":["adp"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mp3":["mp3"],"audio/mp4":["m4a","mp4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/vnd.dece.audio":["uva","uvva"],"audio/vnd.digital-winds":["eol"],"audio/vnd.dra":["dra"],"audio/vnd.dts":["dts"],"audio/vnd.dts.hd":["dtshd"],"audio/vnd.lucent.voice":["lvp"],"audio/vnd.ms-playready.media.pya":["pya"],"audio/vnd.nuera.ecelp4800":["ecelp4800"],"audio/vnd.nuera.ecelp7470":["ecelp7470"],"audio/vnd.nuera.ecelp9600":["ecelp9600"],"audio/vnd.rip":["rip"],"audio/wav":["wav"],"audio/wave":["wav"],"audio/webm":["weba"],"audio/x-aac":["aac"],"audio/x-aiff":["aif","aiff","aifc"],"audio/x-caf":["caf"],"audio/x-flac":["flac"],"audio/x-m4a":["m4a"],"audio/x-matroska":["mka"],"audio/x-mpegurl":["m3u"],"audio/x-ms-wax":["wax"],"audio/x-ms-wma":["wma"],"audio/x-pn-realaudio":["ram","ra"],"audio/x-pn-realaudio-plugin":["rmp"],"audio/x-realaudio":["ra"],"audio/x-wav":["wav"],"audio/xm":["xm"],"chemical/x-cdx":["cdx"],"chemical/x-cif":["cif"],"chemical/x-cmdf":["cmdf"],"chemical/x-cml":["cml"],"chemical/x-csml":["csml"],"chemical/x-xyz":["xyz"],"font/opentype":["otf"],"image/apng":["apng"],"image/bmp":["bmp"],"image/cgm":["cgm"],"image/g3fax":["g3"],"image/gif":["gif"],"image/ief":["ief"],"image/jpeg":["jpeg","jpg","jpe"],"image/ktx":["ktx"],"image/png":["png"],"image/prs.btif":["btif"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/tiff":["tiff","tif"],"image/vnd.adobe.photoshop":["psd"],"image/vnd.dece.graphic":["uvi","uvvi","uvg","uvvg"],"image/vnd.djvu":["djvu","djv"],"image/vnd.dvb.subtitle":["sub"],"image/vnd.dwg":["dwg"],"image/vnd.dxf":["dxf"],"image/vnd.fastbidsheet":["fbs"],"image/vnd.fpx":["fpx"],"image/vnd.fst":["fst"],"image/vnd.fujixerox.edmics-mmr":["mmr"],"image/vnd.fujixerox.edmics-rlc":["rlc"],"image/vnd.ms-modi":["mdi"],"image/vnd.ms-photo":["wdp"],"image/vnd.net-fpx":["npx"],"image/vnd.wap.wbmp":["wbmp"],"image/vnd.xiff":["xif"],"image/webp":["webp"],"image/x-3ds":["3ds"],"image/x-cmu-raster":["ras"],"image/x-cmx":["cmx"],"image/x-freehand":["fh","fhc","fh4","fh5","fh7"],"image/x-icon":["ico"],"image/x-jng":["jng"],"image/x-mrsid-image":["sid"],"image/x-ms-bmp":["bmp"],"image/x-pcx":["pcx"],"image/x-pict":["pic","pct"],"image/x-portable-anymap":["pnm"],"image/x-portable-bitmap":["pbm"],"image/x-portable-graymap":["pgm"],"image/x-portable-pixmap":["ppm"],"image/x-rgb":["rgb"],"image/x-tga":["tga"],"image/x-xbitmap":["xbm"],"image/x-xpixmap":["xpm"],"image/x-xwindowdump":["xwd"],"message/rfc822":["eml","mime"],"model/iges":["igs","iges"],"model/mesh":["msh","mesh","silo"],"model/vnd.collada+xml":["dae"],"model/vnd.dwf":["dwf"],"model/vnd.gdl":["gdl"],"model/vnd.gtw":["gtw"],"model/vnd.mts":["mts"],"model/vnd.vtu":["vtu"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["x3db","x3dbz"],"model/x3d+vrml":["x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/hjson":["hjson"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/jsx":["jsx"],"text/less":["less"],"text/mathml":["mml"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/prs.lines.tag":["dsc"],"text/richtext":["rtx"],"text/rtf":["rtf"],"text/sgml":["sgml","sgm"],"text/slim":["slim","slm"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vnd.curl":["curl"],"text/vnd.curl.dcurl":["dcurl"],"text/vnd.curl.mcurl":["mcurl"],"text/vnd.curl.scurl":["scurl"],"text/vnd.dvb.subtitle":["sub"],"text/vnd.fly":["fly"],"text/vnd.fmi.flexstor":["flx"],"text/vnd.graphviz":["gv"],"text/vnd.in3d.3dml":["3dml"],"text/vnd.in3d.spot":["spot"],"text/vnd.sun.j2me.app-descriptor":["jad"],"text/vnd.wap.wml":["wml"],"text/vnd.wap.wmlscript":["wmls"],"text/vtt":["vtt"],"text/x-asm":["s","asm"],"text/x-c":["c","cc","cxx","cpp","h","hh","dic"],"text/x-component":["htc"],"text/x-fortran":["f","for","f77","f90"],"text/x-handlebars-template":["hbs"],"text/x-java-source":["java"],"text/x-lua":["lua"],"text/x-markdown":["markdown","md","mkd"],"text/x-nfo":["nfo"],"text/x-opml":["opml"],"text/x-pascal":["p","pas"],"text/x-processing":["pde"],"text/x-sass":["sass"],"text/x-scss":["scss"],"text/x-setext":["etx"],"text/x-sfv":["sfv"],"text/x-suse-ymp":["ymp"],"text/x-uuencode":["uu"],"text/x-vcalendar":["vcs"],"text/x-vcard":["vcf"],"text/xml":["xml"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/jpeg":["jpgv"],"video/jpm":["jpm","jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/vnd.dece.hd":["uvh","uvvh"],"video/vnd.dece.mobile":["uvm","uvvm"],"video/vnd.dece.pd":["uvp","uvvp"],"video/vnd.dece.sd":["uvs","uvvs"],"video/vnd.dece.video":["uvv","uvvv"],"video/vnd.dvb.file":["dvb"],"video/vnd.fvt":["fvt"],"video/vnd.mpegurl":["mxu","m4u"],"video/vnd.ms-playready.media.pyv":["pyv"],"video/vnd.uvvu.mp4":["uvu","uvvu"],"video/vnd.vivo":["viv"],"video/webm":["webm"],"video/x-f4v":["f4v"],"video/x-fli":["fli"],"video/x-flv":["flv"],"video/x-m4v":["m4v"],"video/x-matroska":["mkv","mk3d","mks"],"video/x-mng":["mng"],"video/x-ms-asf":["asf","asx"],"video/x-ms-vob":["vob"],"video/x-ms-wm":["wm"],"video/x-ms-wmv":["wmv"],"video/x-ms-wmx":["wmx"],"video/x-ms-wvx":["wvx"],"video/x-msvideo":["avi"],"video/x-sgi-movie":["movie"],"video/x-smv":["smv"],"x-conference/x-cooltalk":["ice"]} -},{}],48:[function(require,module,exports){ +},{}],45:[function(require,module,exports){ "use strict" var compile = require("cwise-compiler") @@ -22559,7 +22381,7 @@ exports.equals = compile({ -},{"cwise-compiler":22}],49:[function(require,module,exports){ +},{"cwise-compiler":19}],46:[function(require,module,exports){ "use strict" var ndarray = require("ndarray") @@ -22582,10 +22404,10 @@ module.exports = function convert(arr, result) { return result } -},{"./doConvert.js":50,"ndarray":51}],50:[function(require,module,exports){ +},{"./doConvert.js":47,"ndarray":48}],47:[function(require,module,exports){ module.exports=require('cwise-compiler')({"args":["array","scalar","index"],"pre":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"body":{"body":"{\nvar _inline_1_v=_inline_1_arg1_,_inline_1_i\nfor(_inline_1_i=0;_inline_1_i<_inline_1_arg2_.length-1;++_inline_1_i) {\n_inline_1_v=_inline_1_v[_inline_1_arg2_[_inline_1_i]]\n}\n_inline_1_arg0_=_inline_1_v[_inline_1_arg2_[_inline_1_arg2_.length-1]]\n}","args":[{"name":"_inline_1_arg0_","lvalue":true,"rvalue":false,"count":1},{"name":"_inline_1_arg1_","lvalue":false,"rvalue":true,"count":1},{"name":"_inline_1_arg2_","lvalue":false,"rvalue":true,"count":4}],"thisVars":[],"localVars":["_inline_1_i","_inline_1_v"]},"post":{"body":"{}","args":[],"thisVars":[],"localVars":[]},"funcName":"convert","blockSize":64}) -},{"cwise-compiler":22}],51:[function(require,module,exports){ +},{"cwise-compiler":19}],48:[function(require,module,exports){ var iota = require("iota-array") var isBuffer = require("is-buffer") @@ -22930,7 +22752,7 @@ function wrappedNDArrayCtor(data, shape, stride, offset) { module.exports = wrappedNDArrayCtor -},{"iota-array":41,"is-buffer":42}],52:[function(require,module,exports){ +},{"iota-array":38,"is-buffer":39}],49:[function(require,module,exports){ // (c) Dean McNamee , 2013. // // https://github.com/deanm/omggif @@ -23714,7 +23536,7 @@ function GifReaderLZWOutputIndexStream(code_stream, p, output, output_length) { try { exports.GifWriter = GifWriter; exports.GifReader = GifReader } catch(e) { } // CommonJS. -},{}],53:[function(require,module,exports){ +},{}],50:[function(require,module,exports){ 'use strict'; @@ -23818,7 +23640,7 @@ exports.setTyped = function (on) { exports.setTyped(TYPED_OK); -},{}],54:[function(require,module,exports){ +},{}],51:[function(require,module,exports){ 'use strict'; // Note: adler32 takes 12% for level 0 and 2% for level 6. @@ -23852,7 +23674,7 @@ function adler32(adler, buf, len, pos) { module.exports = adler32; -},{}],55:[function(require,module,exports){ +},{}],52:[function(require,module,exports){ 'use strict'; @@ -23904,7 +23726,7 @@ module.exports = { //Z_NULL: null // Use -1 or null inline, depending on var type }; -},{}],56:[function(require,module,exports){ +},{}],53:[function(require,module,exports){ 'use strict'; // Note: we can't get significant speed boost here. @@ -23947,7 +23769,7 @@ function crc32(crc, buf, len, pos) { module.exports = crc32; -},{}],57:[function(require,module,exports){ +},{}],54:[function(require,module,exports){ 'use strict'; var utils = require('../utils/common'); @@ -25804,7 +25626,7 @@ exports.deflatePrime = deflatePrime; exports.deflateTune = deflateTune; */ -},{"../utils/common":53,"./adler32":54,"./crc32":56,"./messages":61,"./trees":62}],58:[function(require,module,exports){ +},{"../utils/common":50,"./adler32":51,"./crc32":53,"./messages":58,"./trees":59}],55:[function(require,module,exports){ 'use strict'; // See state defs from inflate.js @@ -26132,7 +25954,7 @@ module.exports = function inflate_fast(strm, start) { return; }; -},{}],59:[function(require,module,exports){ +},{}],56:[function(require,module,exports){ 'use strict'; @@ -27672,7 +27494,7 @@ exports.inflateSyncPoint = inflateSyncPoint; exports.inflateUndermine = inflateUndermine; */ -},{"../utils/common":53,"./adler32":54,"./crc32":56,"./inffast":58,"./inftrees":60}],60:[function(require,module,exports){ +},{"../utils/common":50,"./adler32":51,"./crc32":53,"./inffast":55,"./inftrees":57}],57:[function(require,module,exports){ 'use strict'; @@ -28001,7 +27823,7 @@ module.exports = function inflate_table(type, lens, lens_index, codes, table, ta return 0; }; -},{"../utils/common":53}],61:[function(require,module,exports){ +},{"../utils/common":50}],58:[function(require,module,exports){ 'use strict'; module.exports = { @@ -28016,7 +27838,7 @@ module.exports = { '-6': 'incompatible version' /* Z_VERSION_ERROR (-6) */ }; -},{}],62:[function(require,module,exports){ +},{}],59:[function(require,module,exports){ 'use strict'; @@ -29220,7 +29042,7 @@ exports._tr_flush_block = _tr_flush_block; exports._tr_tally = _tr_tally; exports._tr_align = _tr_align; -},{"../utils/common":53}],63:[function(require,module,exports){ +},{"../utils/common":50}],60:[function(require,module,exports){ 'use strict'; @@ -29251,7 +29073,7 @@ function ZStream() { module.exports = ZStream; -},{}],64:[function(require,module,exports){ +},{}],61:[function(require,module,exports){ (function (process){ // Copyright Joyent, Inc. and other Node contributors. // @@ -29479,7 +29301,7 @@ var substr = 'ab'.substr(-1) === 'b' ; }).call(this,require('_process')) -},{"_process":87}],65:[function(require,module,exports){ +},{"_process":84}],62:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -29675,7 +29497,7 @@ exports.dataToBitMap = function(data, bitmapInfo) { }; }).call(this,require("buffer").Buffer) -},{"./interlace":75,"buffer":10}],66:[function(require,module,exports){ +},{"./interlace":72,"buffer":7}],63:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -29743,7 +29565,7 @@ module.exports = function(data, width, height, options) { }; }).call(this,require("buffer").Buffer) -},{"./constants":68,"buffer":10}],67:[function(require,module,exports){ +},{"./constants":65,"buffer":7}],64:[function(require,module,exports){ (function (process,Buffer){ 'use strict'; @@ -29956,7 +29778,7 @@ ChunkStream.prototype._process = function() { }; }).call(this,require('_process'),require("buffer").Buffer) -},{"_process":87,"buffer":10,"stream":106,"util":114}],68:[function(require,module,exports){ +},{"_process":84,"buffer":7,"stream":103,"util":111}],65:[function(require,module,exports){ 'use strict'; @@ -29992,7 +29814,7 @@ module.exports = { GAMMA_DIVISION: 100000 }; -},{}],69:[function(require,module,exports){ +},{}],66:[function(require,module,exports){ 'use strict'; var crcTable = []; @@ -30038,7 +29860,7 @@ CrcCalculator.crc32 = function(buf) { return crc ^ -1; }; -},{}],70:[function(require,module,exports){ +},{}],67:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -30225,7 +30047,7 @@ module.exports = function(pxData, width, height, options, bpp) { }; }).call(this,require("buffer").Buffer) -},{"./paeth-predictor":79,"buffer":10}],71:[function(require,module,exports){ +},{"./paeth-predictor":76,"buffer":7}],68:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -30254,7 +30076,7 @@ var FilterAsync = module.exports = function(bitmapInfo) { util.inherits(FilterAsync, ChunkStream); }).call(this,require("buffer").Buffer) -},{"./chunkstream":67,"./filter-parse":73,"buffer":10,"util":114}],72:[function(require,module,exports){ +},{"./chunkstream":64,"./filter-parse":70,"buffer":7,"util":111}],69:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -30281,7 +30103,7 @@ exports.process = function(inBuffer, bitmapInfo) { return Buffer.concat(outBuffers); }; }).call(this,require("buffer").Buffer) -},{"./filter-parse":73,"./sync-reader":85,"buffer":10}],73:[function(require,module,exports){ +},{"./filter-parse":70,"./sync-reader":82,"buffer":7}],70:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -30456,7 +30278,7 @@ Filter.prototype._reverseFilterLine = function(rawData) { }; }).call(this,require("buffer").Buffer) -},{"./interlace":75,"./paeth-predictor":79,"buffer":10}],74:[function(require,module,exports){ +},{"./interlace":72,"./paeth-predictor":76,"buffer":7}],71:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -30549,7 +30371,7 @@ module.exports = function(indata, imageData) { }; }).call(this,require("buffer").Buffer) -},{"buffer":10}],75:[function(require,module,exports){ +},{"buffer":7}],72:[function(require,module,exports){ 'use strict'; // Adam 7 @@ -30637,7 +30459,7 @@ exports.getInterlaceIterator = function(width) { return (outerX * 4) + (outerY * width * 4); }; }; -},{}],76:[function(require,module,exports){ +},{}],73:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -30686,7 +30508,7 @@ PackerAsync.prototype.pack = function(data, width, height, gamma) { }; }).call(this,require("buffer").Buffer) -},{"./constants":68,"./packer":78,"buffer":10,"stream":106,"util":114}],77:[function(require,module,exports){ +},{"./constants":65,"./packer":75,"buffer":7,"stream":103,"util":111}],74:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -30738,7 +30560,7 @@ module.exports = function(metaData, opt) { }; }).call(this,require("buffer").Buffer) -},{"./constants":68,"./packer":78,"buffer":10,"zlib":8}],78:[function(require,module,exports){ +},{"./constants":65,"./packer":75,"buffer":7,"zlib":5}],75:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -30833,7 +30655,7 @@ Packer.prototype.packIEND = function() { return this._packChunk(constants.TYPE_IEND, null); }; }).call(this,require("buffer").Buffer) -},{"./bitpacker":66,"./constants":68,"./crc":69,"./filter-pack":70,"buffer":10,"zlib":8}],79:[function(require,module,exports){ +},{"./bitpacker":63,"./constants":65,"./crc":66,"./filter-pack":67,"buffer":7,"zlib":5}],76:[function(require,module,exports){ 'use strict'; module.exports = function paethPredictor(left, above, upLeft) { @@ -30851,7 +30673,7 @@ module.exports = function paethPredictor(left, above, upLeft) { } return upLeft; }; -},{}],80:[function(require,module,exports){ +},{}],77:[function(require,module,exports){ 'use strict'; var util = require('util'); @@ -30963,7 +30785,7 @@ ParserAsync.prototype._complete = function(filteredData) { this.emit('parsed', normalisedBitmapData); }; -},{"./bitmapper":65,"./chunkstream":67,"./filter-parse-async":71,"./format-normaliser":74,"./parser":82,"util":114,"zlib":8}],81:[function(require,module,exports){ +},{"./bitmapper":62,"./chunkstream":64,"./filter-parse-async":68,"./format-normaliser":71,"./parser":79,"util":111,"zlib":5}],78:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -31058,7 +30880,7 @@ module.exports = function(buffer, options) { }; }).call(this,require("buffer").Buffer) -},{"./bitmapper":65,"./filter-parse-sync":72,"./format-normaliser":74,"./parser":82,"./sync-reader":85,"buffer":10,"zlib":8}],82:[function(require,module,exports){ +},{"./bitmapper":62,"./filter-parse-sync":69,"./format-normaliser":71,"./parser":79,"./sync-reader":82,"buffer":7,"zlib":5}],79:[function(require,module,exports){ (function (Buffer){ 'use strict'; @@ -31352,7 +31174,7 @@ Parser.prototype._parseIEND = function(data) { }; }).call(this,require("buffer").Buffer) -},{"./constants":68,"./crc":69,"buffer":10}],83:[function(require,module,exports){ +},{"./constants":65,"./crc":66,"buffer":7}],80:[function(require,module,exports){ 'use strict'; @@ -31370,7 +31192,7 @@ exports.write = function(png) { return pack(png); }; -},{"./packer-sync":77,"./parser-sync":81}],84:[function(require,module,exports){ +},{"./packer-sync":74,"./parser-sync":78}],81:[function(require,module,exports){ (function (process,Buffer){ 'use strict'; @@ -31537,7 +31359,7 @@ PNG.prototype.adjustGamma = function() { }; }).call(this,require('_process'),require("buffer").Buffer) -},{"./packer-async":76,"./parser-async":80,"./png-sync":83,"_process":87,"buffer":10,"stream":106,"util":114}],85:[function(require,module,exports){ +},{"./packer-async":73,"./parser-async":77,"./png-sync":80,"_process":84,"buffer":7,"stream":103,"util":111}],82:[function(require,module,exports){ 'use strict'; var SyncReader = module.exports = function(buffer) { @@ -31590,7 +31412,7 @@ SyncReader.prototype.process = function() { }; -},{}],86:[function(require,module,exports){ +},{}],83:[function(require,module,exports){ (function (process){ 'use strict'; @@ -31637,7 +31459,7 @@ function nextTick(fn, arg1, arg2, arg3) { } }).call(this,require('_process')) -},{"_process":87}],87:[function(require,module,exports){ +},{"_process":84}],84:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -31823,10 +31645,10 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],88:[function(require,module,exports){ +},{}],85:[function(require,module,exports){ module.exports = require('./lib/_stream_duplex.js'); -},{"./lib/_stream_duplex.js":89}],89:[function(require,module,exports){ +},{"./lib/_stream_duplex.js":86}],86:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -31951,7 +31773,7 @@ function forEach(xs, f) { f(xs[i], i); } } -},{"./_stream_readable":91,"./_stream_writable":93,"core-util-is":21,"inherits":40,"process-nextick-args":86}],90:[function(require,module,exports){ +},{"./_stream_readable":88,"./_stream_writable":90,"core-util-is":18,"inherits":37,"process-nextick-args":83}],87:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -31999,7 +31821,7 @@ function PassThrough(options) { PassThrough.prototype._transform = function (chunk, encoding, cb) { cb(null, chunk); }; -},{"./_stream_transform":92,"core-util-is":21,"inherits":40}],91:[function(require,module,exports){ +},{"./_stream_transform":89,"core-util-is":18,"inherits":37}],88:[function(require,module,exports){ (function (process,global){ // Copyright Joyent, Inc. and other Node contributors. // @@ -33009,7 +32831,7 @@ function indexOf(xs, x) { return -1; } }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./_stream_duplex":89,"./internal/streams/BufferList":94,"./internal/streams/destroy":95,"./internal/streams/stream":96,"_process":87,"core-util-is":21,"events":26,"inherits":40,"isarray":43,"process-nextick-args":86,"safe-buffer":101,"string_decoder/":107,"util":6}],92:[function(require,module,exports){ +},{"./_stream_duplex":86,"./internal/streams/BufferList":91,"./internal/streams/destroy":92,"./internal/streams/stream":93,"_process":84,"core-util-is":18,"events":23,"inherits":37,"isarray":40,"process-nextick-args":83,"safe-buffer":98,"string_decoder/":104,"util":3}],89:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -33224,7 +33046,7 @@ function done(stream, er, data) { return stream.push(null); } -},{"./_stream_duplex":89,"core-util-is":21,"inherits":40}],93:[function(require,module,exports){ +},{"./_stream_duplex":86,"core-util-is":18,"inherits":37}],90:[function(require,module,exports){ (function (process,global){ // Copyright Joyent, Inc. and other Node contributors. // @@ -33891,7 +33713,7 @@ Writable.prototype._destroy = function (err, cb) { cb(err); }; }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./_stream_duplex":89,"./internal/streams/destroy":95,"./internal/streams/stream":96,"_process":87,"core-util-is":21,"inherits":40,"process-nextick-args":86,"safe-buffer":101,"util-deprecate":111}],94:[function(require,module,exports){ +},{"./_stream_duplex":86,"./internal/streams/destroy":92,"./internal/streams/stream":93,"_process":84,"core-util-is":18,"inherits":37,"process-nextick-args":83,"safe-buffer":98,"util-deprecate":108}],91:[function(require,module,exports){ 'use strict'; /**/ @@ -33966,7 +33788,7 @@ module.exports = function () { return BufferList; }(); -},{"safe-buffer":101}],95:[function(require,module,exports){ +},{"safe-buffer":98}],92:[function(require,module,exports){ 'use strict'; /**/ @@ -34039,13 +33861,13 @@ module.exports = { destroy: destroy, undestroy: undestroy }; -},{"process-nextick-args":86}],96:[function(require,module,exports){ +},{"process-nextick-args":83}],93:[function(require,module,exports){ module.exports = require('events').EventEmitter; -},{"events":26}],97:[function(require,module,exports){ +},{"events":23}],94:[function(require,module,exports){ module.exports = require('./readable').PassThrough -},{"./readable":98}],98:[function(require,module,exports){ +},{"./readable":95}],95:[function(require,module,exports){ exports = module.exports = require('./lib/_stream_readable.js'); exports.Stream = exports; exports.Readable = exports; @@ -34054,13 +33876,13 @@ exports.Duplex = require('./lib/_stream_duplex.js'); exports.Transform = require('./lib/_stream_transform.js'); exports.PassThrough = require('./lib/_stream_passthrough.js'); -},{"./lib/_stream_duplex.js":89,"./lib/_stream_passthrough.js":90,"./lib/_stream_readable.js":91,"./lib/_stream_transform.js":92,"./lib/_stream_writable.js":93}],99:[function(require,module,exports){ +},{"./lib/_stream_duplex.js":86,"./lib/_stream_passthrough.js":87,"./lib/_stream_readable.js":88,"./lib/_stream_transform.js":89,"./lib/_stream_writable.js":90}],96:[function(require,module,exports){ module.exports = require('./readable').Transform -},{"./readable":98}],100:[function(require,module,exports){ +},{"./readable":95}],97:[function(require,module,exports){ module.exports = require('./lib/_stream_writable.js'); -},{"./lib/_stream_writable.js":93}],101:[function(require,module,exports){ +},{"./lib/_stream_writable.js":90}],98:[function(require,module,exports){ /* eslint-disable node/no-deprecated-api */ var buffer = require('buffer') var Buffer = buffer.Buffer @@ -34124,7 +33946,7 @@ SafeBuffer.allocUnsafeSlow = function (size) { return buffer.SlowBuffer(size) } -},{"buffer":10}],102:[function(require,module,exports){ +},{"buffer":7}],99:[function(require,module,exports){ var encode = require('./lib/encoder'), decode = require('./lib/decoder'); @@ -34133,7 +33955,7 @@ module.exports = { decode: decode }; -},{"./lib/decoder":103,"./lib/encoder":104}],103:[function(require,module,exports){ +},{"./lib/decoder":100,"./lib/encoder":101}],100:[function(require,module,exports){ (function (Buffer){ /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- / /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */ @@ -35116,7 +34938,7 @@ function decode(jpegData) { } }).call(this,require("buffer").Buffer) -},{"buffer":10}],104:[function(require,module,exports){ +},{"buffer":7}],101:[function(require,module,exports){ (function (Buffer){ /* Copyright (c) 2008, Adobe Systems Incorporated @@ -35886,7 +35708,7 @@ function getImageDataFromImage(idOrElement){ } }).call(this,require("buffer").Buffer) -},{"buffer":10}],105:[function(require,module,exports){ +},{"buffer":7}],102:[function(require,module,exports){ (function (Buffer){ 'use strict' @@ -36031,7 +35853,7 @@ module.exports = function savePixels (array, type, options) { } }).call(this,require("buffer").Buffer) -},{"buffer":10,"contentstream":12,"gif-encoder":28,"jpeg-js":102,"ndarray":51,"ndarray-ops":48,"pngjs-nozlib":84,"through":108}],106:[function(require,module,exports){ +},{"buffer":7,"contentstream":9,"gif-encoder":25,"jpeg-js":99,"ndarray":48,"ndarray-ops":45,"pngjs-nozlib":81,"through":105}],103:[function(require,module,exports){ // Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a @@ -36160,7 +35982,7 @@ Stream.prototype.pipe = function(dest, options) { return dest; }; -},{"events":26,"inherits":40,"readable-stream/duplex.js":88,"readable-stream/passthrough.js":97,"readable-stream/readable.js":98,"readable-stream/transform.js":99,"readable-stream/writable.js":100}],107:[function(require,module,exports){ +},{"events":23,"inherits":37,"readable-stream/duplex.js":85,"readable-stream/passthrough.js":94,"readable-stream/readable.js":95,"readable-stream/transform.js":96,"readable-stream/writable.js":97}],104:[function(require,module,exports){ 'use strict'; var Buffer = require('safe-buffer').Buffer; @@ -36433,7 +36255,7 @@ function simpleWrite(buf) { function simpleEnd(buf) { return buf && buf.length ? this.write(buf) : ''; } -},{"safe-buffer":101}],108:[function(require,module,exports){ +},{"safe-buffer":98}],105:[function(require,module,exports){ (function (process){ var Stream = require('stream') @@ -36545,7 +36367,7 @@ function through (write, end, opts) { }).call(this,require('_process')) -},{"_process":87,"stream":106}],109:[function(require,module,exports){ +},{"_process":84,"stream":103}],106:[function(require,module,exports){ "use strict" function unique_pred(list, compare) { @@ -36604,7 +36426,7 @@ function unique(list, compare, sorted) { module.exports = unique -},{}],110:[function(require,module,exports){ +},{}],107:[function(require,module,exports){ var mime = require('mime'); var fs = require('fs'); @@ -36614,7 +36436,7 @@ module.exports = function urifyNode (file) { return 'data:' + type + ';base64,' + data; }; -},{"fs":9,"mime":46}],111:[function(require,module,exports){ +},{"fs":6,"mime":43}],108:[function(require,module,exports){ (function (global){ /** @@ -36685,16 +36507,16 @@ function config (name) { } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],112:[function(require,module,exports){ -arguments[4][40][0].apply(exports,arguments) -},{"dup":40}],113:[function(require,module,exports){ +},{}],109:[function(require,module,exports){ +arguments[4][37][0].apply(exports,arguments) +},{"dup":37}],110:[function(require,module,exports){ module.exports = function isBuffer(arg) { return arg && typeof arg === 'object' && typeof arg.copy === 'function' && typeof arg.fill === 'function' && typeof arg.readUInt8 === 'function'; } -},{}],114:[function(require,module,exports){ +},{}],111:[function(require,module,exports){ (function (process,global){ // Copyright Joyent, Inc. and other Node contributors. // @@ -37284,34 +37106,25 @@ function hasOwnProperty(obj, prop) { } }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":113,"_process":87,"inherits":112}],115:[function(require,module,exports){ +},{"./support/isBuffer":110,"_process":84,"inherits":109}],112:[function(require,module,exports){ function AddStep(ref, image, name, o) { function addStep(image, name, o_) { - ref.log('\x1b[36m%s\x1b[0m','adding step \"' + name + '\" to \"' + image + '\".'); - var o = ref.copy(o_); - o.id = ref.options.sequencerCounter++; //Gives a Unique ID to each step + o.number = ref.options.sequencerCounter++; //Gives a Unique ID to each step o.name = o_.name || name; o.selector = o_.selector || 'ismod-' + name; o.container = o_.container || ref.options.selector; o.image = image; - var module = ref.modules[name].call(ref.images,o); + var UI = ref.UI({ + stepName: o.name, + stepID: o.number, + imageName: o.image + }); + var module = ref.modules[name](o,UI); ref.images[image].steps.push(module); - - function defaultSetupModule() { - if (ref.options.ui && ref.options.ui!="none") module.options.ui = ref.options.ui({ - selector: o.selector, - title: module.options.title, - id: o.id - }); - } - if (module.hasOwnProperty('setup')) module.setup(); // add a default UI, unless the module has one specified - else defaultSetupModule.apply(module); // run default setup() in scope of module (is this right?) - - // tell the UI that a step has been added. return true; } @@ -37319,7 +37132,7 @@ function AddStep(ref, image, name, o) { } module.exports = AddStep; -},{}],116:[function(require,module,exports){ +},{}],113:[function(require,module,exports){ function objTypeOf(object){ return Object.prototype.toString.call(object).split(" ")[1].slice(0,-1) } @@ -37485,7 +37298,7 @@ function formatInput(args,format,images) { } module.exports = formatInput; -},{}],117:[function(require,module,exports){ +},{}],114:[function(require,module,exports){ if (typeof window !== 'undefined') {window.$ = window.jQuery = require('jquery'); isBrowser = true} else {var isBrowser = false} @@ -37529,7 +37342,10 @@ ImageSequencer = function ImageSequencer(options) { modules = require('./Modules'), formatInput = require('./FormatInput'), images = {}, - inputlog = []; + inputlog = [], + UI; + + setUI(); // if in browser, prompt for an image // if (options.imageSelect || options.inBrowser) addStep('image-select'); @@ -37554,7 +37370,7 @@ ImageSequencer = function ImageSequencer(options) { function removeStep(image,index) { //remove the step from images[image].steps and redraw remaining images if(index>0) { - log('\x1b[31m%s\x1b[0m',"Removing "+index+" from "+image); + images[image].steps[index].UI.onRemove(); images[image].steps.splice(index,1); } //tell the UI a step has been removed @@ -37600,7 +37416,6 @@ ImageSequencer = function ImageSequencer(options) { } function run(t_image,t_from) { - log('\x1b[32m%s\x1b[0m',"Running the Sequencer!"); const this_ = (this.name == "ImageSequencer")?this:this.sequencer; var args = (this.name == "ImageSequencer")?[]:[this.images]; for (var arg in arguments) args.push(copy(arguments[arg])); @@ -37636,6 +37451,8 @@ ImageSequencer = function ImageSequencer(options) { removeSteps: this.removeSteps, insertSteps: this.insertSteps, run: this.run, + UI: this.UI, + setUI: this.setUI, images: loadedimages }; } @@ -37645,9 +37462,21 @@ ImageSequencer = function ImageSequencer(options) { return require('./ReplaceImage')(this,selector,steps); } + function setUI(_UI) { + UI = require('./UserInterface')(_UI,options); + return UI; + } + return { + //literals and objects name: "ImageSequencer", options: options, + inputlog: inputlog, + modules: modules, + images: images, + UI: UI, + + //user functions loadImages: loadImages, loadImage: loadImages, addSteps: addSteps, @@ -37655,10 +37484,9 @@ ImageSequencer = function ImageSequencer(options) { insertSteps: insertSteps, replaceImage: replaceImage, run: run, - inputlog: inputlog, - modules: modules, - images: images, - ui: options.ui, + setUI: setUI, + + //other functions log: log, objTypeOf: objTypeOf, copy: copy @@ -37667,35 +37495,26 @@ ImageSequencer = function ImageSequencer(options) { } module.exports = ImageSequencer; -},{"./AddStep":115,"./FormatInput":116,"./InsertStep":118,"./LoadImage":119,"./Modules":120,"./ReplaceImage":121,"./Run":122,"jquery":44}],118:[function(require,module,exports){ +},{"./AddStep":112,"./FormatInput":113,"./InsertStep":115,"./LoadImage":116,"./Modules":117,"./ReplaceImage":118,"./Run":119,"./UserInterface":120,"jquery":41}],115:[function(require,module,exports){ function InsertStep(ref, image, index, name, o) { function insertStep(image, index, name, o_) { - ref.log('\x1b[36m%s\x1b[0m','inserting step \"' + name + '\" to \"' + image + '\" at \"'+index+'\".'); - var o = ref.copy(o_); - o.id = ref.options.sequencerCounter++; //Gives a Unique ID to each step - o.name = o.name || name; - o.selector = o.selector || 'ismod-' + name; - o.container = o.container || ref.options.selector; + o.number = ref.options.sequencerCounter++; //Gives a Unique ID to each step + o.name = o_.name || name; + o.selector = o_.selector || 'ismod-' + name; + o.container = o_.container || ref.options.selector; o.image = image; if(index==-1) index = ref.images[image].steps.length; - var module = ref.modules[name](o); - ref.images[image].steps.splice(index, 0, module); - - function defaultSetupModule() { - if (ref.options.ui && ref.options.ui!="none") module.options.ui = ref.options.ui({ - selector: o.selector, - title: module.options.title, - id: o.id - }); - } - if (module.hasOwnProperty('setup')) module.setup(); // add a default UI, unless the module has one specified - else defaultSetupModule.apply(module); // run default setup() in scope of module (is this right?) - - // tell the UI that a step has been inserted. + var UI = ref.UI({ + stepName: o.name, + stepID: o.number, + imageName: o.image + }); + var module = ref.modules[name](o,UI); + ref.images[image].steps.splice(index,0,module); return true; } @@ -37704,7 +37523,7 @@ function InsertStep(ref, image, index, name, o) { } module.exports = InsertStep; -},{}],119:[function(require,module,exports){ +},{}],116:[function(require,module,exports){ function LoadImage(ref, name, src) { function CImage(src) { var datauri = (ref.options.inBrowser || src.substring(0,11) == "data:image/")?(src):require('urify')(src); @@ -37724,6 +37543,11 @@ function LoadImage(ref, name, src) { name: "load-image", title: "Load Image" }, + UI: ref.UI({ + stepName: "load-image", + stepID: ref.options.sequencerCounter++, + imageName: name + }), draw: function() { if(arguments.length==1){ this.output = CImage(arguments[0]); @@ -37740,6 +37564,9 @@ function LoadImage(ref, name, src) { }] }; ref.images[name] = image; + ref.images[name].steps[0].UI.onSetup(); + ref.images[name].steps[0].UI.onDraw(); + ref.images[name].steps[0].UI.onComplete(image.steps[0].output.src); } return loadImage(name,src); @@ -37747,7 +37574,7 @@ function LoadImage(ref, name, src) { module.exports = LoadImage; -},{"urify":110}],120:[function(require,module,exports){ +},{"urify":107}],117:[function(require,module,exports){ /* * Core modules */ @@ -37762,7 +37589,7 @@ module.exports = { 'decode-qr': require('./modules/DecodeQr/Module') } -},{"./modules/Crop/Module":124,"./modules/DecodeQr/Module":125,"./modules/DoNothing/Module":126,"./modules/DoNothingPix/Module.js":127,"./modules/GreenChannel/Module":128,"./modules/Invert/Module":129,"./modules/NdviRed/Module":130,"./modules/SegmentedColormap/Module":131}],121:[function(require,module,exports){ +},{"./modules/Crop/Module":122,"./modules/DecodeQr/Module":123,"./modules/DoNothing/Module":124,"./modules/DoNothingPix/Module.js":125,"./modules/GreenChannel/Module":126,"./modules/Invert/Module":127,"./modules/NdviRed/Module":128,"./modules/SegmentedColormap/Module":129}],118:[function(require,module,exports){ function ReplaceImage(ref,selector,steps,options) { if(!ref.options.inBrowser) return false; // This isn't for Node.js var this_ = ref; @@ -37799,7 +37626,7 @@ function ReplaceImage(ref,selector,steps,options) { module.exports = ReplaceImage; -},{}],122:[function(require,module,exports){ +},{}],119:[function(require,module,exports){ function Run(ref, json_q, callback) { function drawStep(drawarray,pos) { if(pos==drawarray.length) { @@ -37848,21 +37675,94 @@ function Run(ref, json_q, callback) { } module.exports = Run; -},{}],123:[function(require,module,exports){ +},{}],120:[function(require,module,exports){ +/* + * Default UI for each image-sequencer module + */ +module.exports = function UserInterface(UI,options) { + + return function userInterface(identity) { + + var UI = UI || {}; + + UI.onSetup = UI.onSetup || function() { + if(options.ui == false) { + // No UI + } + else if(options.inBrowser) { + // Create and append an HTML Element + console.log("Added Step \""+identity.stepName+"\" to \""+identity.imageName+"\"."); + } + else { + // Create a NodeJS Object + console.log('\x1b[36m%s\x1b[0m',"Added Step \""+identity.stepName+"\" to \""+identity.imageName+"\"."); + + } + } + + UI.onDraw = UI.onDraw || function() { + if (options.ui == false) { + // No UI + } + else if(options.inBrowser) { + // Overlay a loading spinner + console.log("Drawing Step \""+identity.stepName+"\" on \""+identity.imageName+"\"."); + } + else { + // Don't do anything + console.log('\x1b[33m%s\x1b[0m',"Drawing Step \""+identity.stepName+"\" on \""+identity.imageName+"\"."); + } + } + + UI.onComplete = UI.onComplete || function(output) { + if (options.ui == false) { + // No UI + } + else if(options.inBrowser) { + // Update the DIV Element + // Hide the laoding spinner + console.log("Drawn Step \""+identity.stepName+"\" on \""+identity.imageName+"\"."); + } + else { + // Update the NodeJS Object + console.log('\x1b[32m%s\x1b[0m',"Drawn Step \""+identity.stepName+"\" on \""+identity.imageName+"\"."); + } + } + + UI.onRemove = UI.onRemove || function(callback) { + if(options.ui == false){ + // No UI + } + else if(options.inBrowser) { + // Remove the DIV Element + console.log("Removing Step \""+identity.stepName+"\" of \""+identity.imageName+"\"."); + } + else { + // Delete the NodeJS Object + console.log('\x1b[31m%s\x1b[0m',"Removing Step \""+identity.stepName+"\" of \""+identity.imageName+"\"."); + } + } + + return UI; + + } + +} + +},{}],121:[function(require,module,exports){ +(function (Buffer){ module.exports = function Crop(input,options,callback) { - var getPixels = require("get-pixels"), - savePixels = require("save-pixels"), - base64 = require('base64-stream'); + var getPixels = require('get-pixels'), + savePixels = require('save-pixels'); getPixels(input.src,function(err,pixels){ - var newdata = []; var ox = options.x || 0; var oy = options.y || 0; var w = options.w || Math.floor(0.5*pixels.shape[0]); var h = options.h || Math.floor(0.5*pixels.shape[1]); var iw = pixels.shape[0]; //Width of Original Image - newarray = new Uint8Array(4*w*h); + var newarray = new Uint8Array(4*w*h); for (var n = oy; n < oy + h; n++) { newarray.set(pixels.data.slice(n*4*iw + ox, n*4*iw + ox + 4*w),4*w*(n-oy)); } @@ -37870,20 +37770,27 @@ module.exports = function Crop(input,options,callback) { pixels.shape = [w,h,4]; pixels.stride[1] = 4*w; - options.format = "jpeg"; + options.format = input.format; - w = base64.encode(); + var chunks = []; + var totalLength = 0; var r = savePixels(pixels, options.format); - r.pipe(w).on('finish',function(){ - data = w.read().toString(); - datauri = 'data:image/' + options.format + ';base64,' + data; + + r.on('data', function(chunk){ + totalLength += chunk.length; + chunks.push(chunk); + }); + + r.on('end', function(){ + var data = Buffer.concat(chunks, totalLength).toString('base64'); + var datauri = 'data:image/' + options.format + ';base64,' + data; callback(datauri,options.format); }); }); +}; -} - -},{"base64-stream":3,"get-pixels":27,"save-pixels":105}],124:[function(require,module,exports){ +}).call(this,require("buffer").Buffer) +},{"buffer":7,"get-pixels":24,"save-pixels":102}],122:[function(require,module,exports){ /* * Image Cropping module * Usage: @@ -37899,21 +37806,23 @@ module.exports = function Crop(input,options,callback) { * y = options.y * y = options.y + options.h */ - module.exports = function CropModule(options) { + module.exports = function CropModule(options,UI) { options = options || {}; options.title = "Crop Image"; - var this_ = this; + UI.onSetup(); var output function draw(input,callback) { - const this_ = this; + UI.onDraw(); + const step = this; require('./Crop')(input,options,function(out,format){ - this_.output = { + step.output = { src: out, format: format } + UI.onComplete(out); callback(); }); @@ -37923,31 +37832,37 @@ module.exports = function Crop(input,options,callback) { return { options: options, draw: draw, - output: output + output: output, + UI: UI } } -},{"./Crop":123}],125:[function(require,module,exports){ +},{"./Crop":121}],123:[function(require,module,exports){ /* * Decodes QR from a given image. */ -module.exports = function DoNothing(options) { +module.exports = function DoNothing(options,UI) { options = options || {}; options.title = "Decode QR Code"; + UI.onSetup(); var output; var jsQR = require('jsqr'); var getPixels = require('get-pixels'); function draw(input,callback) { - var this_ = this; + + UI.onDraw(); + + const step = this; getPixels(input.src,function(err,pixels){ if(err) throw err; var w = pixels.shape[0]; var h = pixels.shape[1]; var decoded = jsQR.decodeQRFromImage(pixels.data,w,h); - this_.output = input; - this_.output.data = decoded; + step.output = input; + step.output.data = decoded; callback(); + UI.onComplete(input.src); }); } @@ -37958,45 +37873,53 @@ module.exports = function DoNothing(options) { } } -},{"get-pixels":27,"jsqr":45}],126:[function(require,module,exports){ +},{"get-pixels":24,"jsqr":42}],124:[function(require,module,exports){ /* * Demo Module. Does nothing. Adds a step where output is equal to input. */ -module.exports = function DoNothing(options) { +module.exports = function DoNothing(options,UI) { options = options || {}; options.title = "Do Nothing"; - var this_ = this; - var output + UI.onSetup(); + var output; function draw(input,callback) { + UI.onDraw(); this.output = input; callback(); + UI.onComplete(this.output.src); } return { options: options, draw: draw, - output: output + output: output, + UI: UI } } -},{}],127:[function(require,module,exports){ +},{}],125:[function(require,module,exports){ /* * This module extracts pixels and saves them as it is. */ -module.exports = function DoNothingPix(options) { +module.exports = function DoNothingPix(options,UI) { options = options || {}; options.title = "Do Nothing with pixels"; + UI.onSetup(); var output; function draw(input,callback) { - var this_ = this; + + UI.onDraw(); + const step = this; + function changePixel(r, g, b, a) { return [r, g, b, a]; } function output(image,datauri,mimetype){ - this_.output = {src:datauri,format:mimetype} + step.output = {src:datauri,format:mimetype} + UI.onComplete(datauri); } return require('../_nomodule/PixelManipulation.js')(input, { output: output, @@ -38005,35 +37928,40 @@ module.exports = function DoNothingPix(options) { image: options.image, callback: callback }); + } return { options: options, draw: draw, - output: output + output: output, + UI: UI } } -},{"../_nomodule/PixelManipulation.js":133}],128:[function(require,module,exports){ +},{"../_nomodule/PixelManipulation.js":131}],126:[function(require,module,exports){ /* * Display only the green channel */ -module.exports = function GreenChannel(options) { +module.exports = function GreenChannel(options,UI) { options = options || {}; options.title = "Green channel only"; options.description = "Displays only the green channel of an image"; + UI.onSetup(); var output; - //function setup() {} // optional - function draw(input,callback) { - var this_ = this; + + UI.onDraw(); + const step = this; + function changePixel(r, g, b, a) { return [0, g, 0, a]; } function output(image,datauri,mimetype){ - this_.output = {src:datauri,format:mimetype} + step.output = {src:datauri,format:mimetype}; + UI.onComplete(datauri); } return require('../_nomodule/PixelManipulation.js')(input, { output: output, @@ -38042,36 +37970,43 @@ module.exports = function GreenChannel(options) { image: options.image, callback: callback }); + } return { options: options, //setup: setup, // optional draw: draw, - output: output + output: output, + UI: UI } } -},{"../_nomodule/PixelManipulation.js":133}],129:[function(require,module,exports){ +},{"../_nomodule/PixelManipulation.js":131}],127:[function(require,module,exports){ /* * Display only the green channel */ -module.exports = function GreenChannel(options) { +module.exports = function GreenChannel(options,UI) { options = options || {}; options.title = "Invert Colors"; options.description = "Inverts the colors of the image"; + UI.onSetup(); var output; //function setup() {} // optional function draw(input,callback) { - var this_ = this; + + UI.onDraw(); + const step = this; + function changePixel(r, g, b, a) { return [255-r, 255-g, 255-b, a]; } function output(image,datauri,mimetype){ - this_.output = {src:datauri,format:mimetype} + step.output = {src:datauri,format:mimetype}; + UI.onComplete(datauri); } return require('../_nomodule/PixelManipulation.js')(input, { output: output, @@ -38080,35 +38015,42 @@ module.exports = function GreenChannel(options) { image: options.image, callback: callback }); + } return { options: options, //setup: setup, // optional draw: draw, - output: output + output: output, + UI: UI } } -},{"../_nomodule/PixelManipulation.js":133}],130:[function(require,module,exports){ +},{"../_nomodule/PixelManipulation.js":131}],128:[function(require,module,exports){ /* * NDVI with red filter (blue channel is infrared) */ -module.exports = function NdviRed(options) { +module.exports = function NdviRed(options,UI) { options = options || {}; options.title = "NDVI for red-filtered cameras (blue is infrared)"; + UI.onSetup(); var output; function draw(input,callback) { - var this_ = this; + + UI.onDraw(); + const step = this; + function changePixel(r, g, b, a) { var ndvi = (b - r) / (1.00 * b + r); var x = 255 * (ndvi + 1) / 2; return [x, x, x, a]; } function output(image,datauri,mimetype){ - this_.output = {src:datauri,format:mimetype} + step.output = {src:datauri,format:mimetype}; + UI.onComplete(datauri); } return require('../_nomodule/PixelManipulation.js')(input, { output: output, @@ -38117,23 +38059,30 @@ module.exports = function NdviRed(options) { image: options.image, callback: callback }); + } return { options: options, - draw: draw + draw: draw, + output: output, + UI:UI } } -},{"../_nomodule/PixelManipulation.js":133}],131:[function(require,module,exports){ -module.exports = function SegmentedColormap(options) { +},{"../_nomodule/PixelManipulation.js":131}],129:[function(require,module,exports){ +module.exports = function SegmentedColormap(options,UI) { options = options || {}; options.title = "Segmented Colormap"; + UI.onSetup(); var output; function draw(input,callback) { - var this_ = this; + + UI.onDraw(); + const step = this; + function changePixel(r, g, b, a) { var ndvi = (b - r) / (r + b); var normalized = (ndvi + 1) / 2; @@ -38141,7 +38090,8 @@ module.exports = function SegmentedColormap(options) { return [res[0], res[1], res[2], 255]; } function output(image,datauri,mimetype){ - this_.output = {src:datauri,format:mimetype} + step.output = {src:datauri,format:mimetype}; + UI.onComplete(datauri); } return require('../_nomodule/PixelManipulation.js')(input, { output: output, @@ -38150,16 +38100,18 @@ module.exports = function SegmentedColormap(options) { image: options.image, callback: callback }); + } return { options: options, draw: draw, - output: output + output: output, + UI: UI } } -},{"../_nomodule/PixelManipulation.js":133,"./SegmentedColormap":132}],132:[function(require,module,exports){ +},{"../_nomodule/PixelManipulation.js":131,"./SegmentedColormap":130}],130:[function(require,module,exports){ /* * Accepts a normalized ndvi and returns the new color-mapped pixel */ @@ -38218,7 +38170,8 @@ var colormaps = { fastie: fastie_colormap } -},{}],133:[function(require,module,exports){ +},{}],131:[function(require,module,exports){ +(function (Buffer){ /* * General purpose per-pixel manipulation * accepting a changePixel() method to remix a pixel's channels @@ -38228,16 +38181,15 @@ module.exports = function PixelManipulation(image, options) { options = options || {}; options.changePixel = options.changePixel || function changePixel(r, g, b, a) { return [r, g, b, a]; - } - var getPixels = require("get-pixels"), - savePixels = require("save-pixels"), - base64 = require('base64-stream'); + }; + var getPixels = require('get-pixels'), + savePixels = require('save-pixels'); getPixels(image.src, function(err, pixels) { if(err) { - console.log("Bad image path") - return + console.log('Bad image path'); + return; } // iterate through pixels; @@ -38246,7 +38198,7 @@ module.exports = function PixelManipulation(image, options) { for(var x = 0; x < pixels.shape[0]; x++) { for(var y = 0; y < pixels.shape[1]; y++) { - pixel = options.changePixel( + var pixel = options.changePixel( pixels.get(x, y, 0), pixels.get(x, y, 1), pixels.get(x, y, 2), @@ -38261,21 +38213,25 @@ module.exports = function PixelManipulation(image, options) { } } - options.format = "jpeg"; - // there may be a more efficient means to encode an image object, // but node modules and their documentation are essentially arcane on this point - w = base64.encode(); + var chunks = []; + var totalLength = 0; var r = savePixels(pixels, options.format); - r.pipe(w).on('finish',function(){ - data = w.read().toString(); - datauri = 'data:image/' + options.format + ';base64,' + data; + + r.on('data', function(chunk){ + totalLength += chunk.length; + chunks.push(chunk); + }); + + r.on('end', function(){ + var data = Buffer.concat(chunks, totalLength).toString('base64'); + var datauri = 'data:image/' + options.format + ';base64,' + data; if (options.output) options.output(options.image,datauri,options.format); if (options.callback) options.callback(); }); - }); +}; -} - -},{"base64-stream":3,"get-pixels":27,"save-pixels":105}]},{},[117]); +}).call(this,require("buffer").Buffer) +},{"buffer":7,"get-pixels":24,"save-pixels":102}]},{},[114]); diff --git a/package.json b/package.json index 5bcff420..b4f7cde0 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,6 @@ "urify": "^2.1.0" }, "devDependencies": { - "base64-stream": "~0.1.3", "browserify": "13.0.0", "buffer": "~5.0.2", "get-pixels": "~3.3.0", diff --git a/src/AddStep.js b/src/AddStep.js index e29ab90e..22298c05 100644 --- a/src/AddStep.js +++ b/src/AddStep.js @@ -1,30 +1,21 @@ function AddStep(ref, image, name, o) { function addStep(image, name, o_) { - ref.log('\x1b[36m%s\x1b[0m','adding step \"' + name + '\" to \"' + image + '\".'); - var o = ref.copy(o_); - o.id = ref.options.sequencerCounter++; //Gives a Unique ID to each step + o.number = ref.options.sequencerCounter++; //Gives a Unique ID to each step o.name = o_.name || name; o.selector = o_.selector || 'ismod-' + name; o.container = o_.container || ref.options.selector; o.image = image; - var module = ref.modules[name].call(ref.images,o); + var UI = ref.UI({ + stepName: o.name, + stepID: o.number, + imageName: o.image + }); + var module = ref.modules[name](o,UI); ref.images[image].steps.push(module); - - function defaultSetupModule() { - if (ref.options.ui && ref.options.ui!="none") module.options.ui = ref.options.ui({ - selector: o.selector, - title: module.options.title, - id: o.id - }); - } - if (module.hasOwnProperty('setup')) module.setup(); // add a default UI, unless the module has one specified - else defaultSetupModule.apply(module); // run default setup() in scope of module (is this right?) - - // tell the UI that a step has been added. return true; } diff --git a/src/ImageSequencer.js b/src/ImageSequencer.js index a4d570a5..de1e6e10 100644 --- a/src/ImageSequencer.js +++ b/src/ImageSequencer.js @@ -41,7 +41,10 @@ ImageSequencer = function ImageSequencer(options) { modules = require('./Modules'), formatInput = require('./FormatInput'), images = {}, - inputlog = []; + inputlog = [], + UI; + + setUI(); // if in browser, prompt for an image // if (options.imageSelect || options.inBrowser) addStep('image-select'); @@ -66,7 +69,7 @@ ImageSequencer = function ImageSequencer(options) { function removeStep(image,index) { //remove the step from images[image].steps and redraw remaining images if(index>0) { - log('\x1b[31m%s\x1b[0m',"Removing "+index+" from "+image); + images[image].steps[index].UI.onRemove(); images[image].steps.splice(index,1); } //tell the UI a step has been removed @@ -112,7 +115,6 @@ ImageSequencer = function ImageSequencer(options) { } function run(t_image,t_from) { - log('\x1b[32m%s\x1b[0m',"Running the Sequencer!"); const this_ = (this.name == "ImageSequencer")?this:this.sequencer; var args = (this.name == "ImageSequencer")?[]:[this.images]; for (var arg in arguments) args.push(copy(arguments[arg])); @@ -148,6 +150,8 @@ ImageSequencer = function ImageSequencer(options) { removeSteps: this.removeSteps, insertSteps: this.insertSteps, run: this.run, + UI: this.UI, + setUI: this.setUI, images: loadedimages }; } @@ -157,9 +161,21 @@ ImageSequencer = function ImageSequencer(options) { return require('./ReplaceImage')(this,selector,steps); } + function setUI(_UI) { + UI = require('./UserInterface')(_UI,options); + return UI; + } + return { + //literals and objects name: "ImageSequencer", options: options, + inputlog: inputlog, + modules: modules, + images: images, + UI: UI, + + //user functions loadImages: loadImages, loadImage: loadImages, addSteps: addSteps, @@ -167,10 +183,9 @@ ImageSequencer = function ImageSequencer(options) { insertSteps: insertSteps, replaceImage: replaceImage, run: run, - inputlog: inputlog, - modules: modules, - images: images, - ui: options.ui, + setUI: setUI, + + //other functions log: log, objTypeOf: objTypeOf, copy: copy diff --git a/src/InsertStep.js b/src/InsertStep.js index cbab43ab..ece3da01 100644 --- a/src/InsertStep.js +++ b/src/InsertStep.js @@ -1,31 +1,22 @@ function InsertStep(ref, image, index, name, o) { function insertStep(image, index, name, o_) { - ref.log('\x1b[36m%s\x1b[0m','inserting step \"' + name + '\" to \"' + image + '\" at \"'+index+'\".'); - var o = ref.copy(o_); - o.id = ref.options.sequencerCounter++; //Gives a Unique ID to each step - o.name = o.name || name; - o.selector = o.selector || 'ismod-' + name; - o.container = o.container || ref.options.selector; + o.number = ref.options.sequencerCounter++; //Gives a Unique ID to each step + o.name = o_.name || name; + o.selector = o_.selector || 'ismod-' + name; + o.container = o_.container || ref.options.selector; o.image = image; if(index==-1) index = ref.images[image].steps.length; - var module = ref.modules[name](o); - ref.images[image].steps.splice(index, 0, module); - - function defaultSetupModule() { - if (ref.options.ui && ref.options.ui!="none") module.options.ui = ref.options.ui({ - selector: o.selector, - title: module.options.title, - id: o.id - }); - } - if (module.hasOwnProperty('setup')) module.setup(); // add a default UI, unless the module has one specified - else defaultSetupModule.apply(module); // run default setup() in scope of module (is this right?) - - // tell the UI that a step has been inserted. + var UI = ref.UI({ + stepName: o.name, + stepID: o.number, + imageName: o.image + }); + var module = ref.modules[name](o,UI); + ref.images[image].steps.splice(index,0,module); return true; } diff --git a/src/LoadImage.js b/src/LoadImage.js index cee3e427..d7453b0d 100644 --- a/src/LoadImage.js +++ b/src/LoadImage.js @@ -17,6 +17,11 @@ function LoadImage(ref, name, src) { name: "load-image", title: "Load Image" }, + UI: ref.UI({ + stepName: "load-image", + stepID: ref.options.sequencerCounter++, + imageName: name + }), draw: function() { if(arguments.length==1){ this.output = CImage(arguments[0]); @@ -33,6 +38,9 @@ function LoadImage(ref, name, src) { }] }; ref.images[name] = image; + ref.images[name].steps[0].UI.onSetup(); + ref.images[name].steps[0].UI.onDraw(); + ref.images[name].steps[0].UI.onComplete(image.steps[0].output.src); } return loadImage(name,src); diff --git a/src/UserInterface.js b/src/UserInterface.js index d483ef8f..8ac3623c 100644 --- a/src/UserInterface.js +++ b/src/UserInterface.js @@ -1,41 +1,72 @@ /* * Default UI for each image-sequencer module */ -module.exports = function UserInterface(options) { +module.exports = function UserInterface(UI,options) { - options = options || {}; - options.container = options.container || ".panels"; - options.id = options.id; - options.instanceName = options.instanceName; - options.random = options.random || parseInt(Math.random() * (new Date()).getTime() / 1000000); - options.uniqueSelector = options.uniqueSelector || options.selector + '-' + options.random; - $(options.container).append('
'); - options.el = options.el || $('.' + options.uniqueSelector); - createLabel(options.el); + return function userInterface(identity) { - // method to remove the UI for a given method, and remove the step - function display(image) { - options.el.find('.image').html(image); - } + var UI = UI || {}; - // method to remove the UI for a given method, and remove the step - function remove() { - $('div#sequencer-'+options.id).remove(); - } + UI.onSetup = UI.onSetup || function() { + if(options.ui == false) { + // No UI + } + else if(options.inBrowser) { + // Create and append an HTML Element + console.log("Added Step \""+identity.stepName+"\" to \""+identity.imageName+"\"."); + } + else { + // Create a NodeJS Object + console.log('\x1b[36m%s\x1b[0m',"Added Step \""+identity.stepName+"\" to \""+identity.imageName+"\"."); - // method to reorder steps, and update the UI - //function move() {} + } + } - function createLabel(el) { - if (options.title) el.prepend('

' + options.title + '

'); - } + UI.onDraw = UI.onDraw || function() { + if (options.ui == false) { + // No UI + } + else if(options.inBrowser) { + // Overlay a loading spinner + console.log("Drawing Step \""+identity.stepName+"\" on \""+identity.imageName+"\"."); + } + else { + // Don't do anything + console.log('\x1b[33m%s\x1b[0m',"Drawing Step \""+identity.stepName+"\" on \""+identity.imageName+"\"."); + } + } + + UI.onComplete = UI.onComplete || function(output) { + if (options.ui == false) { + // No UI + } + else if(options.inBrowser) { + // Update the DIV Element + // Hide the laoding spinner + console.log("Drawn Step \""+identity.stepName+"\" on \""+identity.imageName+"\"."); + } + else { + // Update the NodeJS Object + console.log('\x1b[32m%s\x1b[0m',"Drawn Step \""+identity.stepName+"\" on \""+identity.imageName+"\"."); + } + } + + UI.onRemove = UI.onRemove || function(callback) { + if(options.ui == false){ + // No UI + } + else if(options.inBrowser) { + // Remove the DIV Element + console.log("Removing Step \""+identity.stepName+"\" of \""+identity.imageName+"\"."); + } + else { + // Delete the NodeJS Object + console.log('\x1b[31m%s\x1b[0m',"Removing Step \""+identity.stepName+"\" of \""+identity.imageName+"\"."); + } + } + + return UI; - return { - el: options.el, - uniqueSelector: options.uniqueSelector, - selector: options.selector, - display: display, - remove: remove } } diff --git a/src/modules/Crop/Crop.js b/src/modules/Crop/Crop.js index ec9ad1c3..7502e00a 100644 --- a/src/modules/Crop/Crop.js +++ b/src/modules/Crop/Crop.js @@ -1,17 +1,15 @@ module.exports = function Crop(input,options,callback) { - var getPixels = require("get-pixels"), - savePixels = require("save-pixels"), - base64 = require('base64-stream'); + var getPixels = require('get-pixels'), + savePixels = require('save-pixels'); getPixels(input.src,function(err,pixels){ - var newdata = []; var ox = options.x || 0; var oy = options.y || 0; var w = options.w || Math.floor(0.5*pixels.shape[0]); var h = options.h || Math.floor(0.5*pixels.shape[1]); var iw = pixels.shape[0]; //Width of Original Image - newarray = new Uint8Array(4*w*h); + var newarray = new Uint8Array(4*w*h); for (var n = oy; n < oy + h; n++) { newarray.set(pixels.data.slice(n*4*iw + ox, n*4*iw + ox + 4*w),4*w*(n-oy)); } @@ -19,15 +17,21 @@ module.exports = function Crop(input,options,callback) { pixels.shape = [w,h,4]; pixels.stride[1] = 4*w; - options.format = "jpeg"; + options.format = input.format; - w = base64.encode(); + var chunks = []; + var totalLength = 0; var r = savePixels(pixels, options.format); - r.pipe(w).on('finish',function(){ - data = w.read().toString(); - datauri = 'data:image/' + options.format + ';base64,' + data; + + r.on('data', function(chunk){ + totalLength += chunk.length; + chunks.push(chunk); + }); + + r.on('end', function(){ + var data = Buffer.concat(chunks, totalLength).toString('base64'); + var datauri = 'data:image/' + options.format + ';base64,' + data; callback(datauri,options.format); }); }); - -} +}; diff --git a/src/modules/Crop/Module.js b/src/modules/Crop/Module.js index b57cbc39..40e8ce6b 100644 --- a/src/modules/Crop/Module.js +++ b/src/modules/Crop/Module.js @@ -13,21 +13,23 @@ * y = options.y * y = options.y + options.h */ - module.exports = function CropModule(options) { + module.exports = function CropModule(options,UI) { options = options || {}; options.title = "Crop Image"; - var this_ = this; + UI.onSetup(); var output function draw(input,callback) { - const this_ = this; + UI.onDraw(); + const step = this; require('./Crop')(input,options,function(out,format){ - this_.output = { + step.output = { src: out, format: format } + UI.onComplete(out); callback(); }); @@ -37,6 +39,7 @@ return { options: options, draw: draw, - output: output + output: output, + UI: UI } } diff --git a/src/modules/DecodeQr/Module.js b/src/modules/DecodeQr/Module.js index c310bde4..bbe92666 100644 --- a/src/modules/DecodeQr/Module.js +++ b/src/modules/DecodeQr/Module.js @@ -1,23 +1,28 @@ /* * Decodes QR from a given image. */ -module.exports = function DoNothing(options) { +module.exports = function DoNothing(options,UI) { options = options || {}; options.title = "Decode QR Code"; + UI.onSetup(); var output; var jsQR = require('jsqr'); var getPixels = require('get-pixels'); function draw(input,callback) { - var this_ = this; + + UI.onDraw(); + + const step = this; getPixels(input.src,function(err,pixels){ if(err) throw err; var w = pixels.shape[0]; var h = pixels.shape[1]; var decoded = jsQR.decodeQRFromImage(pixels.data,w,h); - this_.output = input; - this_.output.data = decoded; + step.output = input; + step.output.data = decoded; callback(); + UI.onComplete(input.src); }); } diff --git a/src/modules/DoNothing/Module.js b/src/modules/DoNothing/Module.js index cf5a5a09..f45712c0 100644 --- a/src/modules/DoNothing/Module.js +++ b/src/modules/DoNothing/Module.js @@ -1,20 +1,23 @@ /* * Demo Module. Does nothing. Adds a step where output is equal to input. */ -module.exports = function DoNothing(options) { +module.exports = function DoNothing(options,UI) { options = options || {}; options.title = "Do Nothing"; - var this_ = this; - var output + UI.onSetup(); + var output; function draw(input,callback) { + UI.onDraw(); this.output = input; callback(); + UI.onComplete(this.output.src); } return { options: options, draw: draw, - output: output + output: output, + UI: UI } } diff --git a/src/modules/DoNothingPix/Module.js b/src/modules/DoNothingPix/Module.js index 64a0d483..0d1974ca 100644 --- a/src/modules/DoNothingPix/Module.js +++ b/src/modules/DoNothingPix/Module.js @@ -1,19 +1,24 @@ /* * This module extracts pixels and saves them as it is. */ -module.exports = function DoNothingPix(options) { +module.exports = function DoNothingPix(options,UI) { options = options || {}; options.title = "Do Nothing with pixels"; + UI.onSetup(); var output; function draw(input,callback) { - var this_ = this; + + UI.onDraw(); + const step = this; + function changePixel(r, g, b, a) { return [r, g, b, a]; } function output(image,datauri,mimetype){ - this_.output = {src:datauri,format:mimetype} + step.output = {src:datauri,format:mimetype} + UI.onComplete(datauri); } return require('../_nomodule/PixelManipulation.js')(input, { output: output, @@ -22,11 +27,13 @@ module.exports = function DoNothingPix(options) { image: options.image, callback: callback }); + } return { options: options, draw: draw, - output: output + output: output, + UI: UI } } diff --git a/src/modules/GreenChannel/Module.js b/src/modules/GreenChannel/Module.js index 6682f984..3b389dc4 100644 --- a/src/modules/GreenChannel/Module.js +++ b/src/modules/GreenChannel/Module.js @@ -1,22 +1,25 @@ /* * Display only the green channel */ -module.exports = function GreenChannel(options) { +module.exports = function GreenChannel(options,UI) { options = options || {}; options.title = "Green channel only"; options.description = "Displays only the green channel of an image"; + UI.onSetup(); var output; - //function setup() {} // optional - function draw(input,callback) { - var this_ = this; + + UI.onDraw(); + const step = this; + function changePixel(r, g, b, a) { return [0, g, 0, a]; } function output(image,datauri,mimetype){ - this_.output = {src:datauri,format:mimetype} + step.output = {src:datauri,format:mimetype}; + UI.onComplete(datauri); } return require('../_nomodule/PixelManipulation.js')(input, { output: output, @@ -25,12 +28,14 @@ module.exports = function GreenChannel(options) { image: options.image, callback: callback }); + } return { options: options, //setup: setup, // optional draw: draw, - output: output + output: output, + UI: UI } } diff --git a/src/modules/Invert/Module.js b/src/modules/Invert/Module.js index 4ce42e02..65106427 100644 --- a/src/modules/Invert/Module.js +++ b/src/modules/Invert/Module.js @@ -1,22 +1,27 @@ /* * Display only the green channel */ -module.exports = function GreenChannel(options) { +module.exports = function GreenChannel(options,UI) { options = options || {}; options.title = "Invert Colors"; options.description = "Inverts the colors of the image"; + UI.onSetup(); var output; //function setup() {} // optional function draw(input,callback) { - var this_ = this; + + UI.onDraw(); + const step = this; + function changePixel(r, g, b, a) { return [255-r, 255-g, 255-b, a]; } function output(image,datauri,mimetype){ - this_.output = {src:datauri,format:mimetype} + step.output = {src:datauri,format:mimetype}; + UI.onComplete(datauri); } return require('../_nomodule/PixelManipulation.js')(input, { output: output, @@ -25,12 +30,14 @@ module.exports = function GreenChannel(options) { image: options.image, callback: callback }); + } return { options: options, //setup: setup, // optional draw: draw, - output: output + output: output, + UI: UI } } diff --git a/src/modules/NdviRed/Module.js b/src/modules/NdviRed/Module.js index 7d5df2fa..a6a9a230 100644 --- a/src/modules/NdviRed/Module.js +++ b/src/modules/NdviRed/Module.js @@ -1,21 +1,26 @@ /* * NDVI with red filter (blue channel is infrared) */ -module.exports = function NdviRed(options) { +module.exports = function NdviRed(options,UI) { options = options || {}; options.title = "NDVI for red-filtered cameras (blue is infrared)"; + UI.onSetup(); var output; function draw(input,callback) { - var this_ = this; + + UI.onDraw(); + const step = this; + function changePixel(r, g, b, a) { var ndvi = (b - r) / (1.00 * b + r); var x = 255 * (ndvi + 1) / 2; return [x, x, x, a]; } function output(image,datauri,mimetype){ - this_.output = {src:datauri,format:mimetype} + step.output = {src:datauri,format:mimetype}; + UI.onComplete(datauri); } return require('../_nomodule/PixelManipulation.js')(input, { output: output, @@ -24,10 +29,13 @@ module.exports = function NdviRed(options) { image: options.image, callback: callback }); + } return { options: options, - draw: draw + draw: draw, + output: output, + UI:UI } } diff --git a/src/modules/SegmentedColormap/Module.js b/src/modules/SegmentedColormap/Module.js index fcd46a57..00aa60b5 100644 --- a/src/modules/SegmentedColormap/Module.js +++ b/src/modules/SegmentedColormap/Module.js @@ -1,11 +1,15 @@ -module.exports = function SegmentedColormap(options) { +module.exports = function SegmentedColormap(options,UI) { options = options || {}; options.title = "Segmented Colormap"; + UI.onSetup(); var output; function draw(input,callback) { - var this_ = this; + + UI.onDraw(); + const step = this; + function changePixel(r, g, b, a) { var ndvi = (b - r) / (r + b); var normalized = (ndvi + 1) / 2; @@ -13,7 +17,8 @@ module.exports = function SegmentedColormap(options) { return [res[0], res[1], res[2], 255]; } function output(image,datauri,mimetype){ - this_.output = {src:datauri,format:mimetype} + step.output = {src:datauri,format:mimetype}; + UI.onComplete(datauri); } return require('../_nomodule/PixelManipulation.js')(input, { output: output, @@ -22,11 +27,13 @@ module.exports = function SegmentedColormap(options) { image: options.image, callback: callback }); + } return { options: options, draw: draw, - output: output + output: output, + UI: UI } } diff --git a/src/modules/_nomodule/PixelManipulation.js b/src/modules/_nomodule/PixelManipulation.js index 335cddca..efb25863 100644 --- a/src/modules/_nomodule/PixelManipulation.js +++ b/src/modules/_nomodule/PixelManipulation.js @@ -7,16 +7,15 @@ module.exports = function PixelManipulation(image, options) { options = options || {}; options.changePixel = options.changePixel || function changePixel(r, g, b, a) { return [r, g, b, a]; - } - var getPixels = require("get-pixels"), - savePixels = require("save-pixels"), - base64 = require('base64-stream'); + }; + var getPixels = require('get-pixels'), + savePixels = require('save-pixels'); getPixels(image.src, function(err, pixels) { if(err) { - console.log("Bad image path") - return + console.log('Bad image path'); + return; } // iterate through pixels; @@ -25,7 +24,7 @@ module.exports = function PixelManipulation(image, options) { for(var x = 0; x < pixels.shape[0]; x++) { for(var y = 0; y < pixels.shape[1]; y++) { - pixel = options.changePixel( + var pixel = options.changePixel( pixels.get(x, y, 0), pixels.get(x, y, 1), pixels.get(x, y, 2), @@ -40,19 +39,22 @@ module.exports = function PixelManipulation(image, options) { } } - options.format = "jpeg"; - // there may be a more efficient means to encode an image object, // but node modules and their documentation are essentially arcane on this point - w = base64.encode(); + var chunks = []; + var totalLength = 0; var r = savePixels(pixels, options.format); - r.pipe(w).on('finish',function(){ - data = w.read().toString(); - datauri = 'data:image/' + options.format + ';base64,' + data; + + r.on('data', function(chunk){ + totalLength += chunk.length; + chunks.push(chunk); + }); + + r.on('end', function(){ + var data = Buffer.concat(chunks, totalLength).toString('base64'); + var datauri = 'data:image/' + options.format + ';base64,' + data; if (options.output) options.output(options.image,datauri,options.format); if (options.callback) options.callback(); }); - }); - -} +}; diff --git a/test/chain.js b/test/chain.js index d5c1ec59..6a77fca3 100644 --- a/test/chain.js +++ b/test/chain.js @@ -8,7 +8,7 @@ var test = require('tape'); require('../src/ImageSequencer.js'); -var sequencer = ImageSequencer({ ui: "none" }); +var sequencer = ImageSequencer({ ui: false }); var red = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAAQABADASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAf/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFQEBAQAAAAAAAAAAAAAAAAAABgj/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwCdABykX//Z"; test('loadImages/loadImage has a name generator.', function (t){ diff --git a/test/image-manip.js b/test/image-manip.js index 38c0b79a..c54dd4cb 100644 --- a/test/image-manip.js +++ b/test/image-manip.js @@ -7,7 +7,7 @@ var test = require('tape'); require('../src/ImageSequencer.js'); -var sequencer = ImageSequencer({ ui: "none" }); +var sequencer = ImageSequencer({ ui: false }); var image = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAAQABADASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAf/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFQEBAQAAAAAAAAAAAAAAAAAABgj/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwCdABykX//Z"; var qr = require('../examples/IS-QR.js'); sequencer.loadImages(image); diff --git a/test/image-sequencer.js b/test/image-sequencer.js index de170852..3c52423b 100644 --- a/test/image-sequencer.js +++ b/test/image-sequencer.js @@ -25,7 +25,7 @@ function copy(g,a) { var parent = (typeof(global)==="undefined")?window:global; var global1 = copy(true,parent); -var sequencer = ImageSequencer({ ui: "none" }); +var sequencer = ImageSequencer({ ui: false }); var red = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAAQABADASIAAhEBAxEB/8QAFQABAQAAAAAAAAAAAAAAAAAAAAf/xAAUEAEAAAAAAAAAAAAAAAAAAAAA/8QAFQEBAQAAAAAAAAAAAAAAAAAABgj/xAAUEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwCdABykX//Z"; test('Image Sequencer has tests', function (t) {