A cli tool to resize and/or crop all images in a given folder and generate a json file with all image names, and their dimensions, filesizes etc.
Uses sharp for image editing, so it shouldn't require any external dependencies.
npm i batch-crop -g
Will start an interactive prompt if called without required arguments.
batch-crop
or
batch-crop -i ./images -o ./resized-images -w 256 -h 256
Possible arguments are:
Path to folder with images.
Path to folder where new images are saved. Will be created if it doesn't exist.
Max width of image.
Max height of image.
Cropping - true or false. Default is true.
Naming convention. Can be same
or numerical
.
Default is same
.
Create JSON with image data. Default is false.
Force interactive prompt even if arguments has been supplied in command line. Default is false.