Skip to content

to-static-images

to-static-images

A CLI tool that converts images to the required format, generates a file structure in JSON, and resizes them if necessary. Useful for static websites, galleries, and automation.

📖 Usage

Create an img-src folder

shell
mkdir img-src

Place images inside img-src

shell
npx to-static-images@latest

💻 Command-line options

OptionTypeDescriptionDefault
srcstringSource folder nameimg-src
diststringResult folder nameimg-dist
formatstringOutput format: webp, jpg, png, avif, or keep original (original)webp
jsonstring | nullOutput JSON filename (or null to skip)null
widthnumber | nullMaximum image width in pixelsnull
heightnumber | nullMaximum image height in pixelsnull
concurrencynumberMaximum number of concurrent image processing tasks5
includeSizebooleanInclude image dimensions (width and height) in the JSON manifestfalse

✨ Examples

shell
npx to-static-images json=static-images format=original
shell
npx to-static-images src=sources height=2000

Run with no arguments (interactive mode)

shell
npx to-static-images