I need help with preprocessing image input in tensorflow js

Hey everyone, I hope you are doing well. I am new to tensorflow js and I am having a really hard time trying to convert an image to this expected input format:

I am using Expo/react native with tensorflow js btw. I have no clue what to do. Please help me. For more context, I am trying to use the efficientnet/lite4 model.

Can someone please help me?

First check this video to learn more about Tensors and their shapes:

Then see how I resized a tensor here to do this sort of thing. Right now it seems yours is 300x300x3 image but you need 260x260x3:

You can use the resizeBilinear

Finally you need to normalize your image data to be within -1 to 1. I teach about normalization here: