Open compress-images in Script Kit
// Menu: Compress Images// Description: Compress images using imagemin// Author: Vojta Holik// Twitter: @vjthlk/** @type {import("@johnlindquist/kit")} */let imagemin = await npm("imagemin");let imageminJpegtran = await npm("imagemin-jpegtran");let imageminJpegRecompress = await npm("imagemin-jpeg-recompress");let imageminPngquant = await npm("imagemin-pngquant");let imageminSvgo = await npm("imagemin-svgo");let imageminGifsicle = await npm("imagemin-gifsicle");let selectedFiles = await getSelectedFile();let filePaths;if (selectedFiles) {filePaths = selectedFiles.split("\n");} else {let droppedFiles = await drop({ placeholder: "Drop images to compress" });filePaths = droppedFiles.map((file) => file.path);}for (let filePath of filePaths) {let directory = path.dirname(filePath);await imagemin([filePath], {destination: directory,plugins: [imageminJpegtran({arithmetic: true,progressive: true,}),imageminJpegRecompress({ max: 85 }),imageminSvgo(),imageminGifsicle({optimizationLevel: 2,}),imageminPngquant({quality: [0.3, 0.5],}),],});}