imop is a versatile command-line tool for optimizing and converting images. Built with Node.js, it offers both an interactive prompt and command-line arguments to make image optimization fast and efficient.
- Batch Image Optimization: Process multiple images in a single run.
- Format Conversion: Easily convert images to JPEG, PNG, or WebP.
- Interactive Mode: A guided, step-by-step process for optimizing your images.
- Command-Line Arguments: Quickly run optimizations directly from your terminal.
- Quality Control: Optimizes images with a default quality setting of 80 to balance file size and visual fidelity.
Make sure you have Node.js installed on your system.
npm install -g imopor if you prefer using npx:
npx imopnote that all the arguments still available when you use npx because it gonna download it temporary on your computer.
imop can be used in many: via interactive prompts or with command-line arguments.
Simply run the script without any arguments to start the interactive mode. The tool will ask you for the input directory, output directory, and the desired output format.
imopYou'll be guided through these prompts:
What is the path of the folder containing the images to optimize?What is the name of the folder for the optimized images?What output image format do you want?
For a faster workflow, you can specify all your options directly in the command. This is especially useful for scripting or repetitive tasks.
imop [options]| Option | Alias | Description | Example |
|---|---|---|---|
--jpeg |
-j |
Optimize images to JPEG format. | imop.js --jpeg |
--png |
-p |
Optimize images to PNG format. | imop.js --png |
--webp |
-w |
Optimize images to WebP format. | imop.js --webp |
--input |
-i |
Specify the input directory containing the source images. | imop.js --input ./my-photos |
--output |
-o |
Specify the output directory for the optimized images. | imop.js --output ./compressed-images |
Optimize all images to WebP format:
imop --webpConvert images from one folder to another in JPEG format:
imop --jpeg --input ./source-images --output ./optimized-jpegsUse a combination of options with short aliases:
imop -w -i ./photos -o ./output-folder- Supported Formats: The tool automatically detects and processes
.jpg,.jpeg,.png,.gif, and.webpfiles from the source directory. - Output Directory: If the specified output directory does not exist, imop will create it for you.
- Default Quality: All images are optimized with a quality setting of 80 to ensure a good balance between compression and visual quality.
coded with love by @likeur