This project is a CLI tool for resizing images. It is designed to be simple and efficient, allowing you to resize images to various sizes. It also supports automatic processing when files are updated by monitoring changes.
- Resizes images to the specified size.
- Monitors file changes and automatically resizes on update.
- Supports overwriting existing files with the
--force
option. - Allows specifying multiple sizes.
- Custom output directory configuration.
To use this tool, you need to have Node.js installed. Once Node.js is set up, you can install the tool globally using the following command:
npm install -g icon-resize
Alternatively, you can run the tool using npx without installing it globally:
npx @harurow/icon-resize <file-path> [options]
npx icon-resize <file-path> [options]
-
--output-dir=<dir>
: Required. Specifies the output directory where the resized images will be saved. -
--size=<size>
: Specifies the size for resizing (can be used multiple times). Example:--size=32
. Default sizes are16, 32, 64, 128
. -
--force, -f
: Overwrites existing files in the output directory. Example:--force
. -
--watch, -w
: Watches for file changes and automatically resizes when the file changes. Example:--watch
. -
--help, -h
: Shows this help message.
- Resize an image to 32x32 pixels and save it to a directory:
npx icon-resize ./path/to/image.png --size=32 --output-dir=output-dir
- Monitor an image file for changes and automatically resize on change:
npx icon-resize ./path/to/image.png --size=64 --output-dir=output-dir --watch
- Resize an image to multiple sizes and overwrite existing files:
npx icon-resize ./path/to/image.png -s 16 -s 128 -o output-dir -f
- Node.js
- npm
Clone the repository:
git clone https://github.com/yourusername/icon-resize.git
cd icon-resize
npm install
You can run tests with the following command:
npm test
The tests are located in the tests directory. During testing, images are automatically copied to a temporary directory, and the output directory is cleared for each test.
This project is licensed under the MIT License. See the LICENSE file for details.