Package Exports
- base64-to-tensor
- base64-to-tensor/dist/convert.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (base64-to-tensor) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
base64-to-tensor
pure js convert a base64 image to tensor
Installation
npm i base64-to-tensor --saveGetting Started
Make sure to have @tensorflow/tfjs-core installed.
import { convert } from "base64-to-tensor";
const tensor = convert(mybase64);Why
The benefits of using pure js to calc the image is in a couple areas:
- size and portablity required is drastically less since you do not need
cairoor any of the native img dev converters. - speed is also faster since the calcs are done at hand without needing to bridge any calls.
- can use tensors in worker threads - profit allows for properly using Tensorflow wasm backends in an API service 🥳.