# Make responsive image sizes (srcset) in AVIF

**Use case:** 

Turns each image into several widths for a responsive srcset, here 480, 960 and 1600 px in AVIF. Each width is one file in the key-value store and one row in the dataset; widths larger than the image are not enlarged. This example uses a NASA photo.

## Input

```json
{
  "images": [
    "https://images-assets.nasa.gov/image/as11-40-5903/as11-40-5903~orig.jpg"
  ],
  "imageFields": [
    "url"
  ],
  "format": "avif",
  "quality": 80,
  "maxKb": 0,
  "maxWidth": 0,
  "maxHeight": 0,
  "fit": "inside",
  "widths": [
    480,
    960,
    1600
  ],
  "stripMetadata": true,
  "keepAnimation": true,
  "lossless": false,
  "background": "#ffffff",
  "maxImages": 1000,
  "maxFileSizeMb": 50,
  "timeoutSecs": 120,
  "maxConcurrency": 4
}
```

## Output

```json
{
  "imageIndex": {
    "label": "#",
    "format": "number"
  },
  "url": {
    "label": "Source",
    "format": "link"
  },
  "status": {
    "label": "Status",
    "format": "text"
  },
  "fileUrl": {
    "label": "Converted file",
    "format": "link"
  },
  "format": {
    "label": "Format",
    "format": "text"
  },
  "width": {
    "label": "Width",
    "format": "number"
  },
  "height": {
    "label": "Height",
    "format": "number"
  },
  "bytes": {
    "label": "Bytes",
    "format": "number"
  },
  "sourceBytes": {
    "label": "Source bytes",
    "format": "number"
  },
  "savedPercent": {
    "label": "Saved %",
    "format": "number"
  },
  "variant": {
    "label": "Width asked",
    "format": "number"
  },
  "note": {
    "label": "Note",
    "format": "text"
  },
  "billable": {
    "label": "Billable",
    "format": "boolean"
  },
  "error": {
    "label": "Error",
    "format": "text"
  }
}
```

## How it works

### 1. Sign up on Apify or log in

The Image Converter & Compressor: WebP, AVIF, JPEG, PNG in Bulk Actor is ready to run with the inputs already set for "Make responsive image sizes (srcset) in AVIF". [Sign up or log in](https://console.apify.com/create-task-from-example/AG9dv4YIQOFrCAUI8) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "Make responsive image sizes (srcset) in AVIF" task

The Image Converter & Compressor: WebP, AVIF, JPEG, PNG in Bulk Actor will start running based on the input automatically. You can also change all the input fields, like images, image link fields, and more, to match your specific use case.

### 3. Receive the "Make responsive image sizes (srcset) in AVIF" output

Monitor the progress in real time. You will be notified as soon as your dataset is complete and ready for review. Each result includes data such as #, source, status, and more.

### 4. Integrate into your workflow

The final output is delivered in JSON, CSV, or Excel format, ready to be plugged into your workflow. You can also [run the "Make responsive image sizes (srcset) in AVIF" task via API](https://apify.com/klarto/image-converter.md).

## FAQ

### How many files does the srcset task make?

The srcset task makes one file per width in 'Responsive widths' for each image, here three. Widths not smaller than the image are made once at its original size.

### Can the srcset task make WebP instead of AVIF?

Yes. Set 'Output format' to WebP in the srcset task; WebP encodes faster and works in all modern browsers.

### What does the srcset task cost?

The srcset task charges $0.002 per output file up to 16 megapixels on the Free plan, less with Store discounts, so three widths of one image cost $0.006. Failed images are free.

## About this Actor

This example demonstrates how to use [Image Converter & Compressor: WebP, AVIF, JPEG, PNG in Bulk](https://apify.com/klarto/image-converter.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/klarto/image-converter.md) to learn more, explore other use cases, and run it yourself.


## How to integrate an Actor?

This Task's input is already configured above. Use it as-is rather than inventing a new one.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For full API examples (JavaScript, Python, CLI, MCP, OpenAPI), see this Task's Actor page: https://apify.com/klarto/image-converter.md

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).
