Vibrant-Colors / node-vibrant

🎨 Extract prominent colors from an image
MIT License
2.02k stars 108 forks source link

Unsupported MIME type: image/x-icon #79

Open Kikobeats opened 6 years ago

Kikobeats commented 6 years ago

I noted that icons are not supported:

Unsupported MIME type: image/x-icon
ERR TypeError: Cannot read property 'bitmap' of undefined
    at NodeImage.getWidth (/Users/josefranciscoverdugambin/Projects/microlink/splashy/node_modules/node-vibrant/lib/image/node.js:101:24)
    at NodeImage.ImageBase.scaleDown (/Users/josefranciscoverdugambin/Projects/microlink/splashy/node_modules/node-vibrant/lib/image/base.js:8:26)
    at Vibrant._process (/Users/josefranciscoverdugambin/Projects/microlink/splashy/node_modules/node-vibrant/lib/vibrant.js:22:15)
    at /Users/josefranciscoverdugambin/Projects/microlink/splashy/node_modules/node-vibrant/lib/vibrant.js:38:51
    at tryCatcher (/Users/josefranciscoverdugambin/Projects/microlink/splashy/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/josefranciscoverdugambin/Projects/microlink/splashy/node_modules/bluebird/js/release/promise.js:512:31)
    at Promise._settlePromise (/Users/josefranciscoverdugambin/Projects/microlink/splashy/node_modules/bluebird/js/release/promise.js:569:18)
    at Promise._settlePromise0 (/Users/josefranciscoverdugambin/Projects/microlink/splashy/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/Users/josefranciscoverdugambin/Projects/microlink/splashy/node_modules/bluebird/js/release/promise.js:694:18)
    at _drainQueueStep (/Users/josefranciscoverdugambin/Projects/microlink/splashy/node_modules/bluebird/js/release/async.js:138:12)
    at _drainQueue (/Users/josefranciscoverdugambin/Projects/microlink/splashy/node_modules/bluebird/js/release/async.js:131:9)
    at Async._drainQueues (/Users/josefranciscoverdugambin/Projects/microlink/splashy/node_modules/bluebird/js/release/async.js:147:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/Users/josefranciscoverdugambin/Projects/microlink/splashy/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:705:18)
    at tryOnImmediate (timers.js:676:5)
    at processImmediate (timers.js:658:5)

That's okay but could be possible to avoid print the message in the terminal?

Also, ideally need a way to avoid the error, just failing silently, I mean, if it's not possible to resolve the icon, then return an empty object for following the workflow and avoid break the code.

crutchcorn commented 5 years ago

Is this error bubbled up properly? (IE, is it passed to the catch conditional)

If not, that's a bug and I'd love to take a look at it. Otherwise, simply use a catch to the promise to catch that error