LinuxCommandLibrary

imgp

Resize and optimize images

TLDR

Convert single images and/or whole directories containing valid image formats

$ imgp [[-x|--res]] [1366x1000] [path/to/directory] [path/to/file]
copy

Scale an image by 75% and overwrite the source image to a target resolution
$ imgp [[-x|--res]] [75] z-w [path/to/file]
copy

Rotate an image clockwise by 90 degrees
$ imgp [[-o|--rotate]] [90] [path/to/file]
copy

SYNOPSIS

imgp [OPTION]... WIDTHxHEIGHT [FILE]...

PARAMETERS

-h, --help
    Show help message and exit

-V, --version
    Show program's version and exit

-f WIDTHxHEIGHT, --fit=WIDTHxHEIGHT
    Fit image into dimensions (no cropping)

-n, --no-resize
    Skip resizing, rename only if applicable

-r, --no-rename
    Skip renaming

-o DIR, --outfile=DIR
    Output directory (overwrites existing files)

-q N, --quality=N
    JPEG quality (1-100, default 95)

-m N, --maxbytes=N
    Resize iteratively until under N bytes

-b, --besteffort
    Ignore errors and continue processing

-v, --verbose
    Print verbose info to stdout

-x SUFFIX, --suffix=SUFFIX
    Custom suffix instead of WIDTHxHEIGHT

-i FILE, --inputlist=FILE
    Read file list from FILE (one per line)

DESCRIPTION

imgp is a command-line tool for resizing and renaming images in bulk. It processes one or more image files, scaling them to a specified WIDTHxHEIGHT while preserving aspect ratio by default. If the original filename does not end with the new dimensions, it appends WIDTHxHEIGHT before the extension (e.g., photo.jpg becomes photo_1280x720.jpg).

Key features include fitting images into dimensions without cropping, disabling resize or rename independently, outputting to a directory (overwriting without warning), adjusting JPEG quality, iterative resizing to meet byte size limits, and best-effort mode to skip errors. It supports JPEG, PNG, WebP, and other formats via Pillow library.

imgp reads files from arguments or stdin list, making it script-friendly for large batches. Verbose output aids debugging. Ideal for thumbnails, web optimization, or photo management without GUI tools.

CAVEATS

Overwrites files in output directory without warning.
Aspect ratio preserved unless using unsupported crops.
Limited to Pillow-supported formats (JPEG, PNG, WebP, etc.).
No undo; test with -n or backups.

EXAMPLE

imgp 1280x720 *.jpg
imgp -f 800x600 -o thumbs/ -q 90 images/*

INSTALLATION

Available via pip (pip install imgp), Arch AUR, or source from GitHub.

HISTORY

Developed by Jarun (ajkumar), first released in 2017. Written in Python using Pillow. Actively maintained on GitHub with 2.x series focusing on speed, WebP support, and byte-size optimization. Popular in minimal setups and scripts.

SEE ALSO

Copied to clipboard