I am developing a native application in react native with expo. I am using typescript. I have existing tensorflow models and I am using tfjs browser methods to convert an image to tensor tf.browser.fromPixels(). This method accepts HTMLImageElement or ImageData as mentioned in the documentation.
I am trying to initialize a new image object and assign the base64 data string to the src attribute, that I get from my expo-camera takePictureAsync() response and then passing the image object to canvas using node-canvas.
const img = new Image()
But using the constructor results into error as follows;
ReferenceError: Can't find variable: Image
I do not receive any import error for using Image constructor. Is it not possible to use web view methods in react native? What am I doing wrong here?
I also tried Image from node-canvas but still getting an error.
import { Image } from "canvas"
and then when trying to initialize using the constructor and getting following error;
TypeError: undefined is not a constructor (evaluating 'new _canvas.Image()')
What does the error mean?
Imageclass is one of those. Though,ImageDatamay be available.