imgconv

Crates.ioimgconv
lib.rsimgconv
version0.1.7
created_at2026-01-17 16:16:35.700037+00
updated_at2026-01-18 01:58:27.553518+00
descriptionA professional command-line tool for converting images between different formats
homepagehttps://github.com/cumulus13/imgconv
repositoryhttps://github.com/cumulus13/imgconv
max_upload_size
id2050729
size81,834
cumulus13 (cumulus13)

documentation

README

imgconv

Crates.io License CI Release

A professional, fast, and reliable command-line tool for converting images between different formats.

Features

  • 🚀 Fast & Efficient - Built with Rust for maximum performance
  • 🎨 Multiple Formats - Supports PNG, JPEG, GIF, BMP, ICO, TIFF, WebP, AVIF, and more
  • 📋 Clipboard Support - Paste images directly from clipboard (IrfanView, GIMP, browsers, etc.)
  • 🔧 Flexible CLI - Multiple input methods (flags or positional arguments)
  • 📦 Smart Detection - Automatically detects output format from file extension
  • 🎯 Quality Control - Adjustable quality settings for lossy formats
  • 🌈 Colored Output - Beautiful, informative terminal output
  • Zero Configuration - Works out of the box

Installation

From crates.io

cargo install imgconv

From source

git clone https://github.com/cumulus13/imgconv
cd imgconv
cargo install --path .

Build from source

git clone https://github.com/cumulus13/imgconv
cd imgconv
cargo build --release
# Binary will be at ./target/release/imgconv

Usage

Basic Usage

The simplest way to convert an image:

imgconv input.webp output.png

With Flags

imgconv -i photo.jpg -o photo.webp

Quality Control

Specify quality for lossy formats (1-100, default: 90):

imgconv input.png output.jpg -q 85

Clipboard Support

Paste from clipboard (works with IrfanView, GIMP, Photoshop, browsers, etc.):

# Auto-detect format from clipboard
imgconv -c output_image
# Output: output_image.png (or detected format)

# Specify output extension (auto-corrects if mismatch)
imgconv -c output_image.png
# If clipboard is JPG → auto-corrects to output_image.jpg

# Force conversion to specific format
imgconv -c output_image -e jpg
# Clipboard PNG → converts to output_image.jpg

imgconv -c output_image.png -e webp
# Any clipboard format → converts to output_image.webp

Clipboard behavior:

  • Without -e: Auto-detects format and corrects extension if needed
  • With -e: Forces conversion to specified format
  • Smart extension correction prevents format mismatches

Force Output Format

When output filename doesn't have an extension:

imgconv input.jpg output -f png

This will create output.png

Mixed Syntax

All these commands are valid:

# Positional arguments
imgconv image.bmp image.png

# With input flag only
imgconv -i photo.webp output.jpg

# With output flag only
imgconv input.png -o result.jpg -q 95

# All flags
imgconv -i input.avif -o output.png -f png -q 100

Supported Formats

Format Extension(s) Read Write
PNG .png
JPEG .jpg, .jpeg
GIF .gif
BMP .bmp
ICO .ico
TIFF .tiff, .tif
WebP .webp
AVIF .avif
PNM .pnm, .pbm, .pgm, .ppm
TGA .tga
DDS .dds
HDR .hdr
Farbfeld .ff

Examples

Convert WebP to PNG

imgconv photo.webp photo.png

Paste from Clipboard (IrfanView, etc.)

Copy image in any image viewer (IrfanView, GIMP, browser), then:

# Save as detected format
imgconv -c my_image

# Save as PNG
imgconv -c screenshot.png

# Convert clipboard to JPEG
imgconv -c photo -e jpg -q 85

Batch Conversion

Convert all WebP files to PNG in the current directory:

Linux/macOS:

for f in *.webp; do imgconv "$f" "${f%.webp}.png"; done

Windows PowerShell:

Get-ChildItem *.webp | ForEach-Object { imgconv $_.Name ($_.BaseName + ".png") }

Windows CMD:

for %f in (*.webp) do imgconv "%f" "%~nf.png"

Compress JPEG

Reduce JPEG file size with lower quality:

imgconv large.jpg compressed.jpg -q 75

Convert to WebP

Modern format with great compression:

imgconv photo.png photo.webp -q 80

Create Thumbnail

Combine with other tools like ImageMagick:

# Resize then convert
convert input.jpg -resize 200x200 temp.jpg && imgconv temp.jpg thumbnail.webp -q 85

CLI Options

Usage: imgconv [OPTIONS] [INPUT] [OUTPUT]

Arguments:
  [INPUT]   Positional input file (alternative to -i)
  [OUTPUT]  Positional output file (alternative to -o)

Options:
  -i, --input <FILE>       Input image file (conflicts with -c)
  -o, --output <FILE>      Output image file or directory
  -c, --clipboard          Paste image from clipboard
  -f, --format <FORMAT>    Output format (auto-detected from extension if not specified)
                           [possible values: png, jpeg, jpg, gif, bmp, ico, tiff, tif, 
                            webp, avif, pnm, tga, dds, hdr, farbfeld]
  -e, --extension <EXT>    Extension for output file (use with -c for conversion)
  -q, --quality <NUM>      Quality for lossy formats like JPEG (1-100) [default: 90]
  -V, --version            Print version information
  -h, --help               Print help

Performance

imgconv is built with Rust and optimized for performance:

  • Fast Decoding: Efficient image parsing
  • Optimized Encoding: Smart compression algorithms
  • Low Memory: Minimal memory footprint
  • Release Build: LTO and optimizations enabled

Error Handling

imgconv provides clear, helpful error messages:

$ imgconv missing.jpg output.png
Error: Input file not found: missing.jpg

$ imgconv input.jpg output.xyz
Error: Could not determine output format from 'output.xyz'. 
Please specify --format or use a recognized extension

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

This project is licensed under either of:

at your option.

👤 Author

Hadi Cahyadi

Buy Me a Coffee

Donate via Ko-fi

Support me on Patreon

Acknowledgments

  • Built with the excellent image crate
  • CLI powered by clap
  • Thanks to the Rust community for amazing tools and libraries

Made with ❤️ using Rust

Commit count: 8

cargo fmt