image-convert
Image Convert
Converts an image to a different format (PNG, JPG, or WebP).
Command
npx agent-media@latest image convert --in <path> --format <format> [options]
Inputs
| Option | Required | Description |
|---|---|---|
--in |
Yes | Input file path or URL |
--format |
Yes | Output format: png, jpg, webp |
--quality |
No | Quality for lossy formats (1-100, default: 80) |
--out |
No | Output path, filename or directory (default: ./) |
--provider |
No | Provider to use (default: auto-detect) |
Output
Returns a JSON object with the converted image path:
{
"ok": true,
"media_type": "image",
"action": "convert",
"provider": "local",
"output_path": "converted_123_abc.webp",
"mime": "image/webp",
"bytes": 23456
}
Examples
Convert PNG to WebP:
npx agent-media@latest image convert --in photo.png --format webp
Convert to high-quality JPEG:
npx agent-media@latest image convert --in photo.png --format jpg --quality 95
Convert with custom output directory:
npx agent-media@latest image convert --in image.png --format webp --out ./converted
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.
129image-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.
68image-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