img

Inspect images and batch-change the size, format and quality of JPEG, PNG and WebP files.

FilesVersion 1.1.4Stable
lil-terminal

Overview

img is a small web-image workbench: inspect an image without extra extensions, then resize or convert JPEG, PNG and WebP files with GD or Imagick when available, one file, a directory, a mask or a file list at a time.

Process images in batches

For image batches, test the transform on one file first, then apply the same resize, format and quality rules to a directory or list.

Syntax

lil-terminal
img <file> [options] · img -f [dir] [mask] [options] · img [options] < <list>

Reference

img <file>

show image information

-s <size>

resize proportionally; one number limits the longest side

-s <size> -w | -h

resize proportionally by the selected width or height

-s <WxH>

resize to exact dimensions

-t <format>

convert to a web format: jpg|png|webp

-q <1..100>

set output quality; default 85

-o <dst>

write one transformed image to an explicit destination

-r

replace the source image after a successful transform

-f [dir] [mask]

transform matching images in a directory; current directory and * are defaults

< <list>

transform image paths listed one per line in a text file

Active file

With the current core, a successfully opened file is immediately available as $. If this module is the highest-priority installed handler for the file extension, typing the filename by itself opens it through this command. These are core conveniences; img <file> remains the explicit form.

Safety

By default a transform writes a sibling name.img.ext file and refuses to replace an existing destination. Use -o for one explicit output or -r only when replacement is intended. Batch mode never follows directories recursively.

Interactive sandbox preview

Run the prepared examples directly on the page. Their results are prebuilt and shown in the browser; no terminal command is executed on the server.

Inspect an image in the current directory

Install and manage

Install the current compatible version. Choose Base for the complete feature set or Minimum for the reduced package; use upgrade to update a module that is already installed.

Base and Minimum are two packages of the same current module release, not separate command versions.

Base package

Install the complete package with local command reference and every published mode.

install img
Minimum package

Install the reduced package. Local reference is omitted; help <cmd> -i opens the current server reference.

install img -m
Exact public version

Install exactly this published version.

install img -v 1.1.4
Check or update

Ask upgrade to check compatibility and replace the installed block only when needed.

upgrade img
Remove module

Remove the extension block while leaving the core and unrelated modules intact.

install img -u

Examples

Examples are copyable command lines, not actions executed by this website. Review paths, permissions and destructive flags before running them on a real project.

Inspect an image in the current directory
cd \sandbox\images | img photo.jpg
Format      JPEG
Dimensions  48x32
MIME        image/jpeg
Size        732 B
Show image information
photo.jpg
Format      JPEG
Dimensions  48x32
MIME        image/jpeg
Size        732 B
Resize proportionally; one number limits the longest side
img $ -s 1200 -t webp -q 82
photo.jpg > photo.img.webp
Resize proportionally by the selected width or height
img photo.jpg -s 32 -w -o photo-thumb.jpg
photo.jpg > photo-thumb.jpg
Resize proportionally; one number limits the longest side
img -f \sandbox\images "*.jpg" -s 1200 -t webp
photo.jpg > photo.img.webp
Transform image paths listed one per line in a text file
img -s 1200 < \sandbox\images\images.txt
photo.jpg > photo.img.jpg
product.jpg > product.img.jpg
Replace the source image after a successful transform
img photo.jpg -s 40 -r
photo.jpg > photo.jpg
Show image information
img \sandbox\images\missing.jpg
File not found

File used in this example: sandbox/images/photo.jpg

The example uses a file or directory from the protected /sandbox/ documentation workspace.

[binary file: photo.jpg]

Related documentation

Current public release

v1.1.42026-08-09

Flexible proportional resize

Adds scalar longest-side resize, explicit width/height proportional modes, exact WxH sizing and compact source-to-result output.