I have a problem with the read properties, I don't know why this is throwing an error, earlier it was working fine, please see this here is some code where it is showing an error
const ClarifaiFace=data.outputs[0].data.regions[0].region_info.bounding_box;
const image = document.getElementById("inputimage");
const width = Number (image.width);
const height= Number (image.height);
console.log(width, height);
return {
leftCol:ClarifaiFace.left_Col * width,
topRow:ClarifaiFace.top_Row * height,
rightCol: width - (ClarifaiFace.right_Col * width),
bottomRow: height-(ClarifaiFace.bottom_Row * height)
}
};
Error:
Type error:annot read properties of null (reading 'width')
It seems there is no such element with id inputimage. That's why image variable is null and therefore you are getting the error about reading property of null.
What worked for me when I got this error was changing "inputimage" to "inputImage" on getElementById in the 'image' variable. Hope this helps!