Skip to content

Latest commit

 

History

History
38 lines (27 loc) · 1.1 KB

File metadata and controls

38 lines (27 loc) · 1.1 KB

Image Resizer

Resize and convert images via command line.

Usage

image-resize --input <file> --output <file> --width <pixels> [--height <pixels>] [--format <format>]

Parameters

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)

Examples

# 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

Error Handling

  • Returns exit code 0 on success
  • Returns exit code 1 with error message on failure
  • Common errors: file not found, unsupported format, invalid dimensions