Documentation
CORSPORXY Logo

Documentation → features

Image Transformation (Beta)

Image transformation lets you fetch, resize, crop, convert, rotate, and optimize a remote image through the regular CORSPROXY URL API.

Public beta: Image transformation is available on all plans. Parameters and limits may change as we learn from beta usage.

Quick start

Every image request needs your API key, image=1, imageWidth, and an encoded source url:

https://corsproxy.io/?key=YOUR_API_KEY&image=1&imageWidth=640&imageHeight=360&imageFit=cover&imageFormat=webp&url=https%3A%2F%2Fexample.com%2Fphoto.jpg

The response body is the transformed image, so the URL can be used directly in an <img> element:

const source = 'https://example.com/photo.jpg';
const params = new URLSearchParams({
  key: 'YOUR_API_KEY',
  image: '1',
  imageWidth: '640',
  imageHeight: '360',
  imageFit: 'cover',
  imagePosition: 'entropy',
  imageFormat: 'webp',
  imageQuality: 'balanced',
  url: source,
});

document.querySelector('img').src = `https://corsproxy.io/?${params}`;

Free and Hobby support image transformation from browser requests. Production also supports server-side clients such as cURL, backend services, and scheduled jobs.

Parameters

ParameterAccepted valuesDefaultDescription
image1RequiredEnables image transformation.
imageWidthInteger from 1 to 4095RequiredOutput width before DPR is applied. Your plan’s smaller maximum still applies.
imageHeightInteger from 1 to 4095AutoOptional output height before DPR is applied.
imageFitinside, cover, contain, fillinsideControls how the source fits the requested dimensions.
imagePositioncenter, top, top-right, right, bottom-right, bottom, bottom-left, left, top-left, attention, entropycenterCrop position. attention and entropy require cover or fill; all positions are ignored by fill.
imageFormatwebp, avif, jpeg, png, autowebpOutput format. auto negotiates against the request’s Accept header and plan formats.
imageQualityeconomy, balanced, highbalancedStable output quality preset.
imageCompressionstandard, faststandardstandard favors smaller files; fast favors encoding speed.
imageDpr1, 2, 31Multiplies width and height for high-density displays.
imageBackgroundtransparent, white, blacktransparentBackground for padding or flattening. Transparent JPEG output is flattened onto white.
imageRotate0, 90, 180, 2700Clockwise rotation in degrees.
imageFlipnone, horizontal, vertical, bothnoneMirrors the output.
imageGrayscale0, 10Set to 1 for grayscale output.

imageDpr is applied before plan limits are checked. For example, imageWidth=1280&imageDpr=2 resolves to 2560 pixels and is not available on Free.

Fit behavior

  • inside preserves aspect ratio and fits within the requested box without enlarging beyond either edge.
  • cover preserves aspect ratio and crops to fill both requested dimensions.
  • contain preserves aspect ratio and pads as needed to match both dimensions.
  • fill resizes to the exact width and height without preserving aspect ratio.

When imageHeight is omitted, inside derives the height from the source aspect ratio. Other fit modes use a square based on imageWidth.

Plan limits

Only a new, uncached derivative consumes the separate image transformation allowance. Repeating the same eligible transformation can use the shared cache without consuming another transformation.

PlanTransformation allowanceBurst protectionMaximum sourceMaximum resolved dimensionOutput formats
Free50 per UTC month20/minute2 MiB1280pxWebP, JPEG, PNG
Hobby1,000 per UTC day100/minute10 MiB2560pxWebP, JPEG, PNG
Production10,000 per UTC day500/minute25 MiB4095pxWebP, AVIF, JPEG, PNG

The maximum source size in this table is specific to image transformation and is separate from the plan’s general proxy response-size limit.

Image delivery still follows your plan’s normal request and bandwidth terms. For example, a cold paid-plan transform is delivered as a regular request and also creates one image transformation; a later edge-cached delivery does not create another transformation.

Caching

Completed derivatives are eligible for shared edge and renderer caching. The cache key includes the source URL, normalized transformation options, and applicable request-header overrides, so identical requests can reuse the same derivative safely.

Production supports the existing ttl query parameter for image responses. Without a custom TTL, transformed images are returned with a long-lived public cache policy. A browser’s Disable cache option or request Cache-Control: no-cache can bypass the outer edge cache during debugging.

Request headers

Paid plans may use the existing repeated reqHeaders parameter for upstream image requests. Request-header overrides are included in cache identity.

&reqHeaders=Referer%3Ahttps%3A%2F%2Fexample.com%2F

Do not combine image=1 with extraction, data conversion, or response-header rewrite parameters.

Errors and quota behavior

  • Invalid transformation parameters return a 4xx response with a JSON error.
  • A source response that is not a supported image returns a 4xx response.
  • An unsupported negotiated format returns 406; a format outside the plan returns 403.
  • Burst protection returns 429 with Retry-After.
  • When the longer-period image allowance is exhausted, CORSPROXY returns 429 with Retry-After by default.
  • In the console, you can opt into returning the original source image unchanged instead. Those responses use X-Transform-Status: quota-exceeded to indicate that the requested transformation was not applied.

Because this feature is in beta, monitor the response status, Content-Type, and X-Transform-Status rather than assuming every successful response was transformed.