# Rename downloaded images from your data fields (SKU, title)

**Use case:** 

Download the images of every item in a dataset and name each file from the item's own fields, for example MET-269-Armchair.webp, with one folder per category inside the ZIP. The sample reads a small public dataset of 8 public-domain product photos with sku, title and category fields. Point it at your own scraper's dataset and use any field as a {placeholder}.

## Input

```json
{
  "imageUrls": [],
  "datasetId": "ICheENS0sp0esoSFy",
  "imageFields": [
    "image"
  ],
  "itemIdFields": [
    "sku",
    "title"
  ],
  "outputFormat": "webp",
  "quality": 82,
  "maxWidth": 1200,
  "stripMetadata": true,
  "minWidth": 0,
  "minHeight": 0,
  "deduplicate": true,
  "fileNameTemplate": "{sku}-{title}",
  "folderTemplate": "{category}",
  "createZip": true,
  "zipMaxSizeMb": 500,
  "concurrency": 10,
  "maxRetries": 3,
  "requestTimeoutSecs": 30,
  "maxFileSizeMb": 25
}
```

## Output

```json
{
  "index": {
    "label": "Index",
    "format": "integer"
  },
  "status": {
    "label": "Status",
    "format": "string"
  },
  "reasonCode": {
    "label": "Reason code",
    "format": "string"
  },
  "reason": {
    "label": "Reason",
    "format": "string"
  },
  "sourceUrl": {
    "label": "Source URL",
    "format": "string"
  },
  "fileUrl": {
    "label": "File URL",
    "format": "string"
  },
  "fileKey": {
    "label": "File key",
    "format": "string"
  },
  "fileName": {
    "label": "File name in ZIP",
    "format": "string"
  },
  "format": {
    "label": "Format",
    "format": "string"
  },
  "width": {
    "label": "Width",
    "format": "integer"
  },
  "height": {
    "label": "Height",
    "format": "integer"
  },
  "originalFormat": {
    "label": "Original format",
    "format": "string"
  },
  "originalWidth": {
    "label": "Original width",
    "format": "integer"
  },
  "originalHeight": {
    "label": "Original height",
    "format": "integer"
  },
  "bytesOriginal": {
    "label": "Size before (bytes)",
    "format": "integer"
  },
  "bytesFinal": {
    "label": "Size after (bytes)",
    "format": "integer"
  },
  "savedPercent": {
    "label": "Saved %",
    "format": "number"
  },
  "sha256": {
    "label": "SHA-256",
    "format": "string"
  },
  "source": {
    "label": "Source",
    "format": "string"
  },
  "sourceItemIndex": {
    "label": "Dataset item index",
    "format": "integer"
  },
  "sourceField": {
    "label": "Dataset field",
    "format": "string"
  },
  "sourceItem": {
    "label": "Source item fields",
    "format": "object"
  }
}
```

## How it works

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

The Bulk Image Downloader & Optimizer: URLs/Dataset to WebP/JPG+ZIP Actor is ready to run with the inputs already set for "Rename downloaded images from your data fields (SKU, title)". [Sign up or log in](https://console.apify.com/create-task-from-example/UkKsytSoGw4sQ3FYr) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "Rename downloaded images from your data fields (SKU, title)" task

The Bulk Image Downloader & Optimizer: URLs/Dataset to WebP/JPG+ZIP Actor will start running based on the input automatically. You can also change all the input fields, like image urls, dataset with image urls, and more, to match your specific use case.

### 3. Receive the "Rename downloaded images from your data fields (SKU, title)" 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 index, status, reason code, 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 "Rename downloaded images from your data fields (SKU, title)" task via API](https://apify.com/zubayer01/bulk-image-downloader-optimizer.md).

## FAQ

### Which fields can I use in file names?

The Rename images task can use any field of your dataset items as a placeholder, such as {sku}, {title} or a nested {product.sku}, plus {index}, {originalName} and {hash8}. Other characters become dashes.

### How do I use my own scraper's data?

Set Dataset with image URLs to your scraper run's dataset and list the field that holds the image links in Image URL fields. The Rename images task then names the files from that dataset's own fields.

### What happens when two files get the same name?

The Rename images task adds -2, -3 and so on to the second and later files with the same name, so no image is overwritten.

### Can I sort the images into folders?

Yes. The Rename images task puts each image into a folder named after its category inside the ZIP, using Folder template {category}. Any field works, for example {brand}/{sku}.

## About this Actor

This example demonstrates how to use [Bulk Image Downloader & Optimizer: URLs/Dataset to WebP/JPG+ZIP](https://apify.com/zubayer01/bulk-image-downloader-optimizer.md) with a specific input configuration. Visit the [Actor detail page](https://apify.com/zubayer01/bulk-image-downloader-optimizer.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/zubayer01/bulk-image-downloader-optimizer.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`).
