Create predefined variants

Last updated Apr 21, 2026 Variants let you specify how images should be resized for different use cases. By default, images are served with a public variant, but you can create up to 100 variants to fit your needs. Follow these steps to create a variant.

Note

Cloudflare Images can deliver SVG files but will not resize them because it is an inherently scalable format. Resize via the Cloudflare dashboard.

  1. In the Cloudflare dashboard, go to the Hosted Images page. Go to Hosted images ↗
  2. Select the Delivery tab.
  3. Select Create variant.
  4. Name your variant and select Create.
  5. Define variables for your new variant, such as resizing options, type of fit, and specific metadata options.

Resize via the API

Make a POST request to create a variant.

curl "https://api.cloudflare.com/client/v4/accounts/{account_id}/images/v1/variants" \
--header "Authorization: Bearer <API_TOKEN>" \
--header "Content-Type: application/json" \
--data '{"id":"<NAME_OF_THE_VARIANT>","options":{"fit":"scale-down","metadata":"none","width":1366,"height":768},"neverRequireSignedURLs":true}

Fit options

The Fit property describes how the width and height dimensions should be interpreted. The chart below describes each of the options.

Fit Options Behavior
Scale down The image is shrunk in size to fully fit within the given width or height, but will not be enlarged.
Contain The image is resized (shrunk or enlarged) to be as large as possible within the given width or height while preserving the aspect ratio.
Cover The image is resized to exactly fill the entire area specified by width and height and will be cropped if necessary.
Crop The image is shrunk and cropped to fit within the area specified by the width and height. The image will not be enlarged. For images smaller than the given dimensions, it is the same as scale-down. For images larger than the given dimensions, it is the same as cover.
Pad The image is resized (shrunk or enlarged) to be as large as possible within the given width or height while preserving the aspect ratio. The extra area is filled with a background color (white by default).

Metadata options

Variants allow you to choose what to do with your image’s metadata information. From the Metadata dropdown, choose:

  • Strip all metadata
  • Strip all metadata except copyright
  • Keep all metadata

Public access

When the Always allow public access option is selected, particular variants will always be publicly accessible, even when images are made private through the use of signed URLs.

Was this helpful?

YesNo

On this page

Create predefined variants - 图1Docs

{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/images/optimization/hosted-images/create-variants/#page","headline":"Create predefined variants","description":"Define named variants in Cloudflare Images to control how hosted images are resized and served.","url":"https://developers.cloudflare.com/images/optimization/hosted-images/create-variants/","inLanguage":"en","image":"https://developers.cloudflare.com/images/optimization/hosted-images/create-variants/og.png?v=cad73a7c74a01c59","dateModified":"2026-04-21","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}


description: Remove image variants from Cloudflare Images using the dashboard or API. title: Delete variants image: https://developers.cloudflare.com/images/optimization/hosted-images/delete-variants/og.png?v=0215f1b34c7a8acb


Skip to content

Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/images/llms.txt
Use this file to discover all available pages before exploring further.