Skip to content

Instantly share code, notes, and snippets.

@dealingwith
Created August 12, 2021 04:35
Show Gist options
  • Save dealingwith/3cdc6420882928df72f9671fd8f366d7 to your computer and use it in GitHub Desktop.
Save dealingwith/3cdc6420882928df72f9671fd8f366d7 to your computer and use it in GitHub Desktop.
let Jimp = await npm('jimp')
let width = await arg('New width in pixels')
let selectedFiles = await getSelectedFile();
let filePaths = selectedFiles.split("\n");
for (let filePath of filePaths) {
Jimp.read(filePath, (err, image) => {
if (err) throw err;
image.resize(parseInt(width), Jimp.AUTO).write(filePath); // save
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment