How do I position the image in scaleMode "CROP"?

I’m trying to change the scaleMode of an image to “CROP” and then reposition in the rectangle.
I have tried using the imageTransform matrix to position the image. But when I run the plugin the image rectangle goes empty. Clearly I am doing something wrong.
Any guidance on how I can change the scaleMode of an image from “FILL” to “CROP” and then scale/position the image within the crop rectangle.
Any help would be much appreciated.

Here’s my function for reference:

async function adjustImage(node) {
const newFills = ;
if (“fills” in node) {
let newPaint = JSON.parse(JSON.stringify(node.fills[0]));
newPaint.scaleMode = “CROP”;
newPaint.imageTransform = [[0.8880506157875061, 0, -1.97], [0, 0.6528603434562683, 0.2295445054769516]];
node.fills = newFills

I believe the issue in this line: let newPaint = JSON.parse(JSON.stringify(node.fills[0]));

Because figma plugin api uses getters and setters under the hood and when you call JSON.stringify you get back almost empty object.

Try to make direct mapping to required object.