Scaling of the psd file is not working ! please help me!

I am creating the copy of the currently opened PSD file and trying to scale it, But it is just not working. It just duplicates the file and no scaling is done. I also want to save that file in the currently opened document’s directory location.

I am using the basic html plugin template

Please have a look at my code. Let me know if there is any solution.

const { entrypoints, storage } = require(“uxp”);

entrypoints.setup({
panels: {
vanilla: {
show(node) {
}
}
}
});

async function createBanners() {
try {
const ps = require(‘photoshop’);
const app = ps.app;
const anchorPosition = ps.constants.AnchorPosition;
const doc = app.activeDocument;
console.log(doc);
var newDoc = await doc.duplicate();
newDoc.resizeCanvas(728, 90, anchorPosition.MIDDLECENTER)
const layers = newDoc.layers;

for (let layer of layers) {
  await layer.scale(75, 30, anchorPosition.MIDDLECENTER);
}

} catch (e) {
alert('error message ’ + (e.message));
}
}

async function generateBanners() {
try {
await require(‘photoshop’).core.executeAsModal(createBanners);
} catch (e) {
alert('error message ’ + (e.message));
}
}

document.getElementById(“btnGenerate”).addEventListener(“click”, generateBanners);

layer.scale has an bug which I expect to resolve fairly soon.

In the meantime, you’ll have to select the layers first. Depending on your situation, you might be able to select them all.

Thank you for your response. Can you please show me how to do that?