Transform Command
The transform command applies modifications to existing images.
floimg transform <input> [options]Options
Section titled “Options”| Option | Alias | Description |
|---|---|---|
--output | -o | Output file path (required) |
--resize | -r | Resize to WxH (e.g., 800x600) |
--width | -w | Resize to width (maintain aspect) |
--height | -h | Resize to height (maintain aspect) |
--format | -f | Convert format (png, jpeg, webp, avif) |
--quality | -q | Quality for lossy formats (1-100) |
--blur | Apply blur (sigma value) | |
--sharpen | Apply sharpen (sigma value) | |
--rotate | Rotate degrees (90, 180, 270) | |
--crop | Crop region (left,top,width,height) |
Examples
Section titled “Examples”Resize
Section titled “Resize”# Resize to exact dimensionsfloimg transform input.png -o output.png --resize 800x600
# Resize by width (maintain aspect ratio)floimg transform input.png -o output.png --width 800
# Resize by heightfloimg transform input.png -o output.png --height 600Format Conversion
Section titled “Format Conversion”# Convert to WebPfloimg transform input.png -o output.webp --format webp
# Convert with quality settingfloimg transform input.png -o output.jpg --format jpeg --quality 85
# Convert to AVIF (smallest size)floimg transform input.png -o output.avif --format avif --quality 80Effects
Section titled “Effects”# Apply blurfloimg transform input.png -o blurred.png --blur 5
# Apply sharpenfloimg transform input.png -o sharp.png --sharpen 2
# Rotate 90 degreesfloimg transform input.png -o rotated.png --rotate 90# Crop region: left, top, width, heightfloimg transform input.png -o cropped.png --crop 100,100,400,300Chaining Transforms
Section titled “Chaining Transforms”# Multiple transforms in one commandfloimg transform input.png -o output.webp \ --resize 800x600 \ --sharpen 1 \ --format webp \ --quality 85Batch Processing
Section titled “Batch Processing”# Process multiple filesfor f in *.png; do floimg transform "$f" -o "output/${f%.png}.webp" --format webpdone
# Using findfind . -name "*.png" -exec floimg transform {} -o {}.webp --format webp \;From URL
Section titled “From URL”# Transform remote imagefloimg transform https://example.com/image.png -o local.webp --format webpPiping
Section titled “Piping”# Pipe inputcat input.png | floimg transform - -o output.webp --format webp
# Pipe outputfloimg transform input.png -o - --format webp | upload-toolTransform Order
Section titled “Transform Order”When multiple transforms are specified, they apply in this order:
- Crop
- Resize
- Rotate
- Blur / Sharpen
- Format conversion
See Also
Section titled “See Also”- CLI Overview - Installation and basics
- Generate Command - Create new images
- SDK Transform - Programmatic transforms