@ideadesignmedia/format-image v1.1.1
@ideadesignmedia/format-image
Easily format images to many specific sizes using this simple script.
Usage
npx @ideadesignmedia/format-image src=path/to/image.jpg destination=path/to/destination size=size,size,size convertedTo=webp height=true
Options
src
The path to the image you want to format. Can be a folder of images or a single image.
destination
The path to the destination filename or folder.
If the destination is a folder, the image will be saved with the same name as the source image to each size.
If the destination does not exist, it will be created.
If the src is a folder, the destination must be a folder.
If the src is a single image, the destination can be a folder or a single image.
If the destination is a single image, the image will be saved with the named for each size:
{destination}-{size}.{extension}
size
The sizes you want to format the image to for width or height in px. Can be a single size or a comma separated list of sizes.
convertedTo
The format you want to convert the image to. Possible formats: webp, jpg, png, tiff, gif, bmp, jp2, jxr, psd, pdf, svg, ico, heic, avif
height
If included image will be formatted to the height instead of the width.