ImageKit 是一款功能强大且速度快的命令行工具,用于批量处理图像。
ImageKit is a powerful, fast, and flexible command-line tool for batch image processing. Written in Rust, it leverages parallel processing to maximize performance, allowing you to effortlessly resize, control the quality of, and add highly customizable watermarks to entire directories of images.
[!IMPORTANT] Migration Notice: This project is now in Maintenance Mode (bug fixes only).
We are excited to announce the release of ImageKit2!
ImageKit2 is a complete rewrite powered by Rust. It provides the same easy-to-use Python bindings but with significantly higher performance, better memory safety, and modern features.
Please upgrade here: https://github.com/hzbd/imagekit2
.jpg, .jpeg, .png, .gif, .bmp, .webp) in a specified input directory.-q or --quality flag (1-100) to fine-tune the output quality, balancing file size and visual fidelity. Set to 100 for the best possible quality.RRGGBB or RRGGBBAA).[!NOTE] You can also directly download the pre-compiled binary package from the release page.
You will need to have Rust and Cargo installed.
Clone the Repository
git clone https://github.com/hzbd/imagekit.git
cd imagekitBuild the Project
cargo build --releaseLocate the Executable
After building, the executable will be located in the target/release/ directory.
./target/release/imagekit \
-i example/img-src \
-o example/img-out \
--watermark-text "你好, World! - Test Watermark"If you want to resize without quality loss for JPEGs, use --quality 100.
./target/release/imagekit -i example/img-src -o example/img-out --width 1024 --quality 100./target/release/imagekit \
-i example/img-src \
-o example/img-out \
--watermark-text "Confidential" \
--watermark-color 000000FF| Option | Flags | Description | Required/Optional | Default |
|---|---|---|---|---|
| Input Directory | -i, --input-dir |
The source directory containing images to process. | Required | - |
| Output Directory | -o, --output-dir |
The directory where processed images will be saved. | Required | - |
| Width | --width |
(Optional) Resize image width. Scales proportionally if height is omitted. | Optional | Original width |
| Height | --height |
(Optional) Resize image height. Scales proportionally if width is omitted. | Optional | Original height |
| Watermark Text | --watermark-text |
(Optional) The text content for the watermark. | Optional | - |
| Watermark Position | --watermark-position |
(Optional) The position of the watermark on the image. | Optional | se |
| Font Size | --font-size |
(Optional) The font size of the watermark text in pixels. | Optional | 24 |
| Watermark Color | --watermark-color |
(Optional) Watermark color in RRGGBB or RRGGBBAA hex format. | Optional | FFFFFF80 (semi-transparent white) |
| Quality | -q, --quality |
(Optional) Set output quality (1-100). Affects JPEG and PNG compression. | Optional | 85 |
| Output Format | --output-format |
(Optional) Specify the output image format. | Optional | Original format |
watermark-position:nw: North-West, north: North, ne: North-Eastwest: West, center: Center, east: Eastsw: South-West, south: South, se: South-East./target/release/imagekit -i example/img-src \
-o example/img-out/ \
--height 512 \
--watermark-text "©良辰 | ちよ | 서연 | Stella | Éléonore | แก้ว" \
--watermark-position se \
--font-size 18 \
--watermark-color ffffffFF \
--output-format pngIf you'd like to contribute to the project:
cargo testThis project is licensed under the MIT License.
暂无开放 Issues,或尚未同步最近议题。