import im from 'imagemagick' import fs from 'node:fs' const originalImage = 'w:\\share\\work\\sb528990\\data\\ВістаменЛібідо\\IMG_1928_Crop.JPG' if (!fs.existsSync(originalImage)) { const sizes = [360, 640, 1024] for (const i in sizes) { const size = sizes[i] const outImage = `w:\\share\\work\\sb528990\\data\\ВістаменЛібідо\\vistamen-libido-feature-${size}x${size}.jpg` im.resize( { srcPath: originalImage, dstPath: outImage, quality: 0.84, format: 'jpg', width: size, height: size, filter: 'sinc', strip: true }, function (err: any) { if (err) throw err console.log(`resized IMG_1928_Crop.JPG to fit within ${size}x${size}px`) } ) } }