question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"Blob is not defined" fetching local images

See original GitHub issue

Hi, i testing face-api.js and trying loading a local image for make face similarity and is throw me “Blob is not defined” in my nodeJS application, here the function where i try computing descriptors:

face.env.monkeyPatch({ fetch, Blob });

const threshold = 0.6;
var descriptors = { desc1: null, desc2: null };

function computarDescriptor(aDesc, aUri) {
  // ~statics/pics/001_tmp.jpg
  face.fetchImage(aUri).then(function(result) {
    console.log('fecthImage: ' + result);
    descriptors['desc' + aDesc] = face.computeFaceDescriptor(result);
  }).catch(err => {
    console.log(err);
  })
}

node-fetch and blob is installed and monkeyPatched and referenceErros is still there.

Thanks

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
hanjeahwancommented, Mar 2, 2019

Ahh, currently face.env.monkeyPatch doesn’t patch Blob, thanks for pointing this out. Maybe as for now you could simply try to expose Blob to the global scope? global.Blob = require('blob');

After i define as global i get

TypeError: Right-hand side of ‘instanceof’ is not an object

tfjs-image-recognition-base\src\dom\bufferToImage.ts:5:14

2reactions
EziamakaNVcommented, Sep 14, 2019

Hi @enecumene, @justadudewhohacks

I had a similar issue a few minutes ago. The only difference is that I was trying to fetch the image from the cloud (cloudinary).

I solved it by using the ‘loadImage’ function from the node ‘canvas’ package i.e

import { loadImage } from ‘canvas’;

const referenceImage = await loadImage(refImageUrl);

It might work for local images. Hope this helps

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fetch and display blob images - Stack Overflow
My approach is to convert images to a blob and save the blob url to indexeddb and then when it's time to display,...
Read more >
Quickstart: Azure Blob Storage client library for Python
In this quickstart, you learn how to use the Azure Blob Storage client library for Python to create a container and a blob...
Read more >
Image & file options | Docs - TinyMCE
Enable or disable automatic upload of images represented by data URLs or blob URIs. Such images get generated, for example, as a result...
Read more >
Blobs / Objects — google-cloud 0.20.0 documentation
Create / interact with Google Cloud Storage blobs. class google.cloud.storage.blob. ... If the property is not set locally, returns None .
Read more >
ActiveStorage::Blob - Rails API
You're allowed to update a blob's metadata on a subsequent pass, but you should not update the key or change the uploaded file....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found