Resize Plan
resize_planWork out the exact scale, padding and crop for a model input size. FREE.
Returns the numbers you need to transform boxes alongside the image, which is the step that usually gets skipped. Typical input {"width": 1920, "height": 1080, "target": "yolo_640"} returns {"scale": 0.3333, "resized": [640, 360], "pad": {"left": 0, "top": 140, "right": 0, "bottom": 140}, "box_transform": "x_new = x * 0.3333 + 0; y_new = y * 0.3333 + 140"}.
Use before feeding an image to a fixed-input model. Not for finding out the image's size in the first place - that is image_probe. Errors: on invalid, missing, or malformed input this tool never raises a protocol error — it returns {"error": ""} (for example {"error": "unknown target ; use one of or set"}). Every call is read-only and idempotent, so after correcting the input it is always safe to retry.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | "letterbox" scales to fit and pads the remainder, preserving aspect; "cover" scales to fill and crops the overflow; "stretch" distorts to fit exactly. Default "letterbox". | letterbox |
| width | Yes | Source image width in pixels. | |
| height | Yes | Source image height in pixels. | |
| target | No | A named preset: "clip_224", "vit_384", "yolo_640", "sam_1024", "sd_512", "sd_768" or "detr_800". Ignored when target_size is set. | yolo_640 |
| target_size | No | A square side length in pixels, overriding target. Use this for a size the presets do not cover. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||