# Resize images in bulk to a maximum width

**Use case:** 

Shrinks each image to a max width or height, keeps the aspect ratio, never enlarges, removes EXIF such as GPS; GIF, TIFF, BMP and ICO become PNG, other formats stay; one ZIP. $0.002 per output image up to 16 MP (Free plan); PNG output adds $0.0025 per started 4 MP. This example resizes two NASA JPEGs of 3,183,792 and 3,889,900 bytes to 1200 px wide JPEGs of 291,606 and 243,738 bytes.

## Input

```json
{
  "images": [
    "https://images-assets.nasa.gov/image/as11-40-5903/as11-40-5903~orig.jpg",
    "https://images-assets.nasa.gov/image/as11-37-5505/as11-37-5505~orig.jpg"
  ],
  "imageFields": [
    "url"
  ],
  "format": "same",
  "quality": 85,
  "maxKb": 0,
  "maxWidth": 1200,
  "maxHeight": 0,
  "fit": "inside",
  "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 "Resize images in bulk to a maximum width". [Sign up or log in](https://console.apify.com/create-task-from-example/dq6BbnZlNjU6qTfgX) and you'll land in Apify Console with a copy of this exact task.

### 2. Start the "Resize images in bulk to a maximum width" 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 "Resize images in bulk to a maximum width" 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 "Resize images in bulk to a maximum width" task via API](https://apify.com/klarto/image-converter.md).

## FAQ

### Does the resize task enlarge small images?

No. In the default Resize mode the task only shrinks: an image already within 'Max width' and 'Max height' keeps its size. With cover it is cropped to the box shape, with contain padded to the box size.

### Can the task resize to an exact box?

Yes. Set both 'Max width' and 'Max height' in the task and pick a Resize mode: contain pads to the exact box with a border; cover crops the center to the box shape and fills the box only if the image is at least that big.

### What does the resize task cost?

The task charges $0.002 per output image up to 16 MP (Free plan; less with Store discounts); PNG output, also from GIF, TIFF, BMP or ICO sources, adds $0.0025 per started 4 MP. Start event: $0.00005 at the default 1 GB. 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`).
