img

Use img to inspect, resize or convert web images.

FilesVersion 1.1.5Stable
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

Try the new settings on one image before processing a folder or list. Originals remain untouched unless you explicitly choose -r.

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.

To prevent memory exhaustion, an image transform accepts at most 32 MiB of input and 24 million source or output pixels (up to 16000 per side). Batch operations accept at most 200 images; list files are limited to 128 KiB. GD and Imagick are optional; transforms require one of them.

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.5
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
img \sandbox\images\photo.jpg
Format      JPEG
Dimensions  48x32
MIME        image/jpeg
Size        732 B
Resize proportionally; one number limits the longest side
img \sandbox\images\photo.jpg -s 24
photo.jpg > photo.img.jpg
Resize proportionally by the selected width or height
img \sandbox\images\photo.jpg -s 24 -w
photo.jpg > photo.img.jpg
Resize proportionally by the selected width or height
img \sandbox\images\photo.jpg -s 24 -h
photo.jpg > photo.img.jpg
Resize to exact dimensions
img \sandbox\images\photo.jpg -s 32x20
photo.jpg > photo.img.jpg
Convert to a web format: jpg|png|webp
img \sandbox\images\photo.jpg -t webp -q 82
photo.jpg > photo.img.webp
Write one transformed image to an explicit destination
img \sandbox\images\photo.jpg -s 24 -o \sandbox\images\thumb.jpg
photo.jpg > thumb.jpg
Replace the source image after a successful transform
img \sandbox\images\photo.jpg -s 24 -r
photo.jpg > photo.jpg
Transform matching images in a directory; current directory and * are defaults
img -f \sandbox\images "*.jpg" -s 24 -t webp
photo.jpg > photo.img.webp
product.jpg > product.img.webp
Transform image paths listed one per line in a text file
img -s 24 < \sandbox\images\images.txt
photo.jpg > photo.img.jpg
product.jpg > product.img.jpg
Show image information
img \sandbox\images\missing.jpg
File not found
Transform matching images in a directory; current directory and * are defaults
img -f \sandbox\images "*.jpg"
Resize or output format required

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.52026-11-01

Production refinement

Current stable release of img. Use img to inspect, resize or convert web images.