imgcon
v1.1.0
Published
A production-ready TypeScript CLI tool to convert image formats.
Readme
ImageConverter
A modern, fast, and production-ready TypeScript CLI for converting image formats, powered by Node.js and Sharp.
NPM Package | GitHub Repository
Features
- Single image conversion: Convert any supported image file to another format.
- Batch processing: Convert every supported image in a directory.
- Recursive scanning: Preserve nested folders when converting directories with
--recursive. - High performance: Built on top of
libvipsthroughsharp. - Clean CLI output: Uses
chalkandorafor readable terminal feedback.
Supported Formats
.jpg/.jpeg.png.webp.avif.tiff/.tif.bmp.ico.gif
Installation
Install the package globally with npm:
npm install -g imgconUsage
imgcon <input> --to <format> [options]<input>: Path to a single image file or a directory containing images.-t, --to <format>: Target output format.-o, --out <dir>: Output directory. Defaults to the input location.-r, --recursive: Recursively scan subdirectories.-q, --quality <number>: Output quality from 1 to 100 for JPG, WEBP, AVIF, and TIFF.
Examples
Convert a single image:
imgcon input.jpg --to png
imgcon image.png --to webpConvert a directory recursively:
imgcon ./images --to avif --recursiveConvert a directory recursively with a specific quality:
imgcon ./images --to webp --out ./dist/images --recursive --quality 80Open the help page:
imgcon --helpDevelopment
npm install
npm run build
npm start -- ./test_images --to webp --out ./converted --recursivePublishing
The package publishes to npm through GitHub Actions when a git tag is pushed. The workflow verifies that the tag version matches package.json, builds the TypeScript source, checks package contents, and publishes with npm provenance.
License
MIT License.
