Resize image
image_resizeResize images by pixel dimensions or percentage while preserving aspect ratio, with crop/fit options, presets, and output formats to prepare files for social, web, or print.
Instructions
Resize an image by pixels or percent, keeping the aspect ratio. Give width or height (the other side follows), or both: fit "cover" (default, as on the website) centre-crops to that ratio first so nothing is stretched, "contain" fits inside the box, "fill" stretches. Optional crop ratio (1:1, 4:5, 3:2, 16:9, 9:16, orig) or crop box before resizing, social-media presets, output JPEG/PNG/WebP/AVIF. Up to 16384 px a side. Output name: -x.. Web version: https://s3eidat.github.io/image-resize/
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fit | No | When both width and height are set: cover (crop to fill, default), contain (fit inside), fill (stretch). | cover |
| crop | No | Crop box (x, y, width, height in pixels) applied before resizing; overrides ratio. | |
| image | Yes | The image: a local file path (absolute, or relative to the server's --root) or base64 data (raw or a data: URI). | |
| ratio | No | Aspect ratio as "W:H" (e.g. "1:1", "4:5", "3:2", "16:9", "9:16"), a number (width/height), "orig" or "free". | |
| width | No | Target width in pixels. | |
| format | No | Output format. "keep" = same as the input when it is JPEG/PNG/WebP (else PNG). Default keep. | keep |
| height | No | Target height in pixels. | |
| output | No | Where to write the result: a file path, or a folder ending in "/". Default: the server output folder (a temp folder unless --out-dir is set). | |
| preset | No | Exact output size preset: instagram-post 1080×1080, instagram-portrait 1080×1350, story 1080×1920, youtube-thumbnail 1280×720, x-header 1500×500, facebook-cover 851×315, linkedin-banner 1584×396, full-hd 1920×1080, passport-35x45 413×531, us-passport-2x2 600×600. | |
| percent | No | Scale by percent instead (e.g. 50 halves both sides, 200 doubles). | |
| quality | No | Quality 1-100 for JPEG / WebP / AVIF (ignored for PNG). Default 90, same as the website. | |
| returnBase64 | No | Also return the output as base64 in the result (only for small files). Default false. |