@madnh/image-transform
v0.0.4
Published
Transform your images
Downloads
3
Readme
Image Transform
CLI to help you to transform your images.
Usage
$ npm install -g @madnh/image-transform
$ image-transform COMMAND
running command...
$ image-transform (--version|--version|-v)
@madnh/image-transform/0.0.4 darwin-arm64 node-v18.17.0
$ image-transform --help [COMMAND]
USAGE
$ image-transform COMMAND
...
Commands
image-transform help [COMMANDS]
Display help for image-transform.
USAGE
$ image-transform help [COMMANDS] [-n]
ARGUMENTS
COMMANDS Command to show help for.
FLAGS
-n, --nested-commands Include all nested commands in the output.
DESCRIPTION
Display help for image-transform.
See code: @oclif/plugin-help
image-transform transform [FILE]
Transform images.
USAGE
$ image-transform transform [FILE] [-c <value>] [-p <value>] [--withEnlargement] [-w <value>] [-h <value>]
[--nameFormat <value>] [--nameRemove <value>] [--jpg] [--png] [--webp] [--avif] [--keepMeta] [-o <value>] [--watch]
[--watchInitial] [--concurrency <value>] [-d <value>] [--quality <value>]
ARGUMENTS
FILE Images to transform, maybe single file, dir or glob pattern. Can ignore if use `--profile`
FLAGS
-c, --configFile=<value> [default: image-transform.config.json] Config file path
-d, --data=<value>... Data to pass to filename format, can be multiple, informat of `key=value`, example: `--data
name=abc --data age=20`
-h, --height=number Resize height, default is auto scale with width
-o, --out=<value> Output directory, if omit then use the same directory with input file
-p, --profile=<value> Profile name
-w, --width=number Resize width, default is auto scale with height
--avif Export to avif
--concurrency=<value> [default: 1] Number of concurrent transform
--jpg Export to jpg
--keepMeta Keep image meta data
--nameFormat=<value> [default: {name}.{ext}] Format of output file name
--nameRemove=<value> Remove part of file name
--png Export to png
--quality=<value> [default: 90] Quality of output image, override defined value in profile.
Useful to reduce file size manually, use with "--data" flag to add versioning, example:
"--quality 80 --data version=1"
--watch Watch file changes
--watchInitial Watch file changes, and run initial transform for current file
--webp Export to webp
--withEnlargement Allow image enlargements
DESCRIPTION
Transform images.
Name format:
{name} - new name (without ext)
{ext} - new extension
{orgName} - original file name
{orgExt} - original file extension
EXAMPLES
$ image-transform transform --profile apple-icons
$ image-transform transform --profile apple-icons --config images-transform.json
$ image-transform transform images/image-1.jpg --webp
$ image-transform transform images/image-1.jpg --webp --width 500 --out images/optimized
$ image-transform transform images/image-1.jpg --avif --png --height=300
$ image-transform transform images/image-1.jpg -w 1000 --webp --avif --png --name-format='{name}@2x.{ext}'
$ image-transform transform images/image-1.jpg --webp --name-remove=__raw
See code: dist/commands/transform.ts