import sharp from "sharp"; for (const [n,p] of [ ["tilia-front","data/media/assets/bb/bbb6833de42bf773dba2e549091dbdb960708dec378ed8ffe195cb1bf3f8fea7.jpg"], ["tilia-sleep","data/media/assets/bf/bf0ca3b0e17acbf1d64cebed6418d5cf50e1adcbc4a336c43175c9360eab93f1.png"], ["tilia-side","data/media/assets/13/13e4137f1ea143793b645cc59a7f8442f106e3b9cd891656fe9d0ed61d8b8864.png"], ]) { const m = await sharp(p).metadata(); const w = m.width ?? 2400, h = m.height ?? 1792; await sharp(p).extract({left:Math.floor(w*0.1),top:Math.floor(h*0.35),width:Math.floor(w*0.55),height:Math.floor(h*0.45)}).png().toFile(`tmp/m-${n}.png`); } console.log("ok");