Convert Command
The convert
command is the primary tool for all image processing tasks.
.\imgtool.exe convert [input_path] [output_path] [flags]
Arguments
input_path
: The path to the source image or directory.output_path
(optional): The path for the output file or directory. If omitted for a single file, the output will be saved in the same directory with the new format extension.
Flags
--to <format>
: The target format (png
,jpg
,gif
,webp
). Default:png
.--quality <int>
: Image quality forjpg
/webp
(1-100). Default:80
.--resize <string>
: Resize dimensions (e.g.,"800x600"
or"50%"
).--watermark <path>
: Path to the watermark image.--watermark-opacity <int>
: Watermark opacity (0-100). Default:100
.--mode <string>
: Processing mode (single
ordir
). Default:single
.--recursive
: Recursively process subdirectories indir
mode.--workers <int>
: Number of concurrent workers fordir
mode. Default:4
.
Examples
-
Convert a PNG to a high-quality JPG
bash .\imgtool.exe convert input.png output.jpg --to jpg --quality 95
-
Resize an image to 50% of its original size
bash .\imgtool.exe convert big.jpg small.jpg --resize "50%"
-
Apply a watermark to an image
bash .\imgtool.exe convert photo.png watermarked.png --watermark logo.png --watermark-opacity 70
-
Process an entire directory of images
This command converts all images in the
input-folder
towebp
and saves them inoutput-folder
.bash .\imgtool.exe convert input-folder output-folder --mode dir --to webp