{"uid":"cap__xIwLA02Ci_tdImu04fzB","slug":"x402-image-tools-resize-9e6dd1bf","name":"x402 Image Tools – Resize","description":"Resize an image at a URL to a width, a height or both, keeping the aspect ratio inside the box by default (cover, contain, inside, outside or fill), optionally converting it. Returns a signed URL of the result, valid for an hour.","url":"https://image.kagurazaka.dev/v1/resize?utm_source=zero.xyz","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"fit":{"enum":["cover","contain","inside","outside","fill"],"type":"string","description":"how to fit the box (default inside)"},"url":{"type":"string","description":"https URL of a JPEG, PNG, WebP, AVIF, GIF, TIFF or SVG image (up to 20 MB, 40 megapixels)"},"width":{"type":"integer","description":"target width (1-8192)"},"format":{"enum":["webp","avif","png","jpeg","gif","tiff"],"type":"string","description":"output format (default: the input's)"},"height":{"type":"integer","description":"target height (1-8192)"},"inline":{"type":"boolean","description":"also return the image as a data URL when it is at most 1 MB"},"enlarge":{"type":"boolean","description":"allow making the image larger (default false)"},"quality":{"type":"integer","description":"1-100"}}},"responseSchema":{"type":"json","example":{"url":"https://dn8i8p8knpn68.cloudfront.net/results/images/3f1c2b9e.webp?Expires=...","bytes":48213,"width":800,"format":"webp","height":600,"expires_in":3600,"input_bytes":912345}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.002","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.002/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.002","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_eBWNc7pk7AJzzJgypRVxE","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.002","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Resizes an image from a URL to specified width and/or height with configurable fit mode, optional format conversion, and returns a signed CDN URL valid for one hour.","exampleAgentPrompt":"Can you resize this product image at https://example.com/product.jpg to 800 pixels wide and 600 pixels tall, containing it inside that box without cropping, and convert it to WebP?","exampleUseCases":[{"title":"E-commerce product image standardization","prompt":"Resize this product photo at https://shop.example.com/item-hero.png to exactly 1200 wide and 900 tall, using 'contain' fit so nothing gets cropped, and convert it to WebP for the web store."},{"title":"Blog post hero image downscaling","prompt":"That blog hero image at https://cdn.myblog.com/post-banner.tiff is way too large — can you scale it down to 1200 pixels wide, keeping the aspect ratio, and give me a link to the result?"},{"title":"Avatar thumbnail preparation","prompt":"I need to resize the user avatar at https://uploads.myapp.com/avatar-full.png to 150 by 150 pixels using 'cover' fit so it fills the square, and convert it to JPEG at quality 85."}],"resultDescription":"A JSON object containing: a signed CloudFront URL to the resized image (valid for 3600 seconds), the output width and height in pixels, the output format, the file size in bytes, the expiry time in seconds, and the original file size in bytes. If the 'inline' flag was set and the result is under 1 MB, a data URL of the image is also included.","failureModes":["Image URL is not publicly accessible or returns a non-200 status — endpoint cannot fetch the source","Image exceeds 20 MB or 40 megapixels — rejected with size limit error","Unsupported image format (e.g. BMP, raw) — only JPEG, PNG, WebP, AVIF, GIF, TIFF, SVG accepted","Both width and height omitted — at least one dimension required","Width or height out of range (must be 1–8192) — validation error","enlarge=false (default) prevents upscaling when requested dimensions exceed source — result will be smaller than requested","Payment not included or insufficient — x402 payment required response","Signed URL expires after 1 hour — subsequent access returns 403"],"whenToPreferThis":"Choose this endpoint when you need to resize an image from a remote URL to specific pixel dimensions with fine control over fit behavior (cover, contain, inside, outside, fill), optionally converting the format in the same call. It is ideal for programmatic media pipelines, e-commerce asset preparation, and responsive web image generation where you need a short-lived CDN link to the result rather than a raw binary. Prefer it over the convert-only or thumbnail endpoints when dimension control matters and smart-crop is not needed.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-29T12:34:34.056Z","isFirstParty":false,"canonicalSlug":"x402-image-tools-resize-9e6dd1bf"}