We all have various tasks we need to accomplish with images. Whether it's resizing, optimizing, organizing, uploading, or anything else. Script Kit provides a drop
component so you can simply drag and drop images into a script and process them in whatever way matches your workflow.
// Name: Drop Image
import "@johnlindquist/kit"
let files = await drop()
let imagePath = files[0].path
let Jimp = await npm("jimp")
let image = await Jimp.read(imagePath)
let newImagePath = path.resolve(
path.dirname(imagePath),
`new-${path.basename(imagePath)}`
)
await image
.resize(parseInt(await arg("Width:"), 10), 100)
.write(newImagePath)