@tola-scripts/image
Inspect image metadata or save resized and converted copies from the command line.
main
tola nu @tola-scripts/imageList subcommands (metadata and resize).
metadata
tola nu @tola-scripts/image metadata <source>Print image dimensions (width, height), format, and alpha support (has-alpha) as JSON.
Positional parameters
sourcepathrequired: Image file path, resolved from the current working directory.
Inspect a local PNG
tola nu @tola-scripts/image metadata photo.pngresize
tola nu @tola-scripts/image resize <source> [OPTIONS]Resize, crop, or convert a local image (including SVG) into a new output file or raw bytes.
Any external images referenced inside an SVG must be embedded as data URIs. Site hooks automatically inherit the site’s [typst.fonts] configuration when rendering SVG text; for standalone runs, pass --config tola.toml before the script name.
Positional parameters
sourcepathrequired: Source image path (raster or SVG).
Options
--output,-opath: Destination path for a new file inside an existing directory. Prints resulting image metadata as JSON. Omit to return raw image bytes.--widthint: Target width in pixels (positive integer). Required byfit-width,scale,fit, andfill.--heightint: Target height in pixels (positive integer). Required byfit-height,scale,fit, andfill.--opstring: Resize mode:fit-width,fit-height(preserve aspect ratio from one side),fit(contain without upscaling),fill(crop to exact size), orscale(stretch to exact size). When omitted, one dimension preserves aspect ratio, two dimensions crop, and no dimensions keep the original size.--anchorstringdefault:'center': Crop focal point forfill. Defaults tocenter; also acceptstop,bottom,left,right,top-left,top-right,bottom-left, andbottom-right. Other modes accept onlycenter.--formatstringdefault:'auto': Output format:png,webp,jpg,jpeg, orauto. For raster inputs,autoselects JPEG for opaque lossy sources and PNG otherwise. SVG inputs require an explicit raster format.--qualityint: Encoding quality:1..100for JPEG (default75),0..100for WebP (lossless when omitted). Ignored for PNG.--filterstringdefault:'lanczos3': Resampling filter for raster inputs:lanczos3(default),nearest,triangle,catmull-rom, orgaussian.--backgroundstring: Opaque#RRGGBBfill color for transparent pixels (for example'#ffffff'). Required when converting images with alpha to JPEG.
Create a width-constrained WebP preview
tola nu @tola-scripts/image resize photo.png --width 640 --format webp --output preview.webpCrop a square thumbnail anchored to the top
tola nu @tola-scripts/image resize photo.png --width 160 --height 160 --anchor top --format webp --output square.webpRasterize an SVG using site fonts
tola nu --config tola.toml @tola-scripts/image resize wordmark.svg --width 240 --format png --output wordmark.png