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 and Base64 images to Tensor

See original GitHub issue

Given the same .jpg image, HTML5 commonly accepts these types of <img /> tags:

<img src="https://domain.com/path/to/my/image.jpg" />
<img src="data:image/jpg;base64,/dh7hfhwehfw9hfw...wh9fh8w9hf" />
<img src="blob:https://domain.com/b3872f9f-acb7-49d9-a26d-4854d72c9939" />

If I am correct, tfjs will only load images using tf.fromPixels(input) which, as its name implies, loads from pixels (= the first type of src). However, I could not find anything like tf.fromBase64(input) nor tf.fromBlob(input) to convert other formats to tensors. More generally, is there any way to process Blobs and/or base64 images through tfjs ? Thanks !

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
0x00b1commented, May 13, 2019

fromPixels accepting a base64 string would be super useful since the HTMLImageElement (or similar) dance is especially cumbersome in our application where images are stored in an IndexedDB database and rarely outputted to the DOM.

0reactions
rthadurcommented, Aug 13, 2019

Automatically closing due to lack of recent activity. Please update the issue when new information becomes available, and we will reopen the issue. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to pass base64 encoded image to Tensorflow prediction?
I have a google-cloud-ml model that I can run prediction by passing a 3 dimensional array of float32... However this is not an...
Read more >
How to convert blob to base64 encoding using JavaScript
Example: Convert Blob to Base64 Encoded String using FileReader API. The FileReader. readAsDataURL() reads the contents of the specified Blob ...
Read more >
Convert An Image To A DataURL or Base64 String Using ...
In this short tutorial we explore 3 different JavaScript methods to convert an image into a Base64 string. We look at converting a...
Read more >
How to convert an Image to blob using JavaScript?
How to convert an image into base64 String in Android using Kotlin? How to convert an image to a PyTorch Tensor? How to...
Read more >
Blob Attributes - Losant Documentation
You can use Blobs to store images. Blob On Image Dashboard. You may report your images as base64 encoded strings. For example state...
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