image-resize
Image Resize
Resizes an image to a target width or height while optionally maintaining aspect ratio.
Command
npx agent-media@latest image resize --in <path> [options]
Inputs
| Option | Required | Description |
|---|---|---|
--in |
Yes | Input file path or URL |
--width |
No | Target width in pixels |
--height |
No | Target height in pixels |
--out |
No | Output path, filename or directory (default: ./) |
--provider |
No | Provider to use (default: auto-detect) |
At least one of --width or --height must be specified.
Output
Returns a JSON object with the resized image path:
{
"ok": true,
"media_type": "image",
"action": "resize",
"provider": "local",
"output_path": "resized_123_abc.png",
"mime": "image/png",
"bytes": 45678
}
Examples
Resize to 800px width:
npx agent-media@latest image resize --in photo.jpg --width 800
Resize to exact dimensions:
npx agent-media@latest image resize --in photo.jpg --width 1024 --height 768
Resize with custom output:
npx agent-media@latest image resize --in image.png --width 500 --out ./resized
Providers
- local (default) - Uses sharp library, no API key required
More from agntswrm/agent-media
audio-transcribe
Transcribes audio to text with timestamps and optional speaker identification. Use when you need to convert speech to text, create subtitles, transcribe meetings, or process voice recordings.
131image-remove-background
Removes the background from an image, leaving the foreground subject with transparency. Use when you need to isolate subjects, create cutouts, or prepare images for compositing.
128image-crop
Crops an image to specified dimensions around a focal point. Use when you need to extract a portion of an image, create thumbnails with custom positioning, or prepare images for specific aspect ratios.
83image-generate
Generates an image from a text prompt using AI models. Use when you need to create images from descriptions, generate artwork, or produce visual content from text.
78video-generate
Generates video from text prompts or animates static images. Use when you need to create videos from descriptions, animate images, or produce video content using AI.
64image-edit
Edits an existing image using a text prompt. Use when you need to modify, enhance, or transform an image based on text instructions.
62