Resize and convert images via command line.
image-resize --input <file> --output <file> --width <pixels> [--height <pixels>] [--format <format>]| Parameter | Required | Description |
|---|---|---|
--input |
Yes | Source image file (jpg, png, webp, gif) |
--output |
Yes | Destination file path |
--width |
Yes | Target width in pixels |
--height |
No | Target height in pixels (maintains aspect ratio if omitted) |
--format |
No | Output format: jpg, png, webp (default: same as input) |
# Resize to 800px width, maintain aspect ratio
image-resize --input photo.jpg --output thumbnail.jpg --width 800
# Resize to exact dimensions
image-resize --input banner.png --output banner-small.png --width 1200 --height 400
# Convert format while resizing
image-resize --input photo.png --output photo.webp --width 600 --format webp- Returns exit code 0 on success
- Returns exit code 1 with error message on failure
- Common errors: file not found, unsupported format, invalid dimensions