# Wikimedia Commons Image Downloader: Files with License & Credit (`data-done-right/wikimedia-commons-image-downloader`) Actor

Download images from Wikimedia Commons by search, category or file title. Get the files plus license, author, attribution text and description page URL for every image. Filter by license and minimum size, dedupe, convert or resize, and get public links plus one ZIP.

- **URL**: https://apify.com/data-done-right/wikimedia-commons-image-downloader.md
- **Developed by:** [Data Done Right](https://apify.com/data-done-right) (community)
- **Categories:** Developer tools, Automation, Other
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.36 / 1,000 files

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

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 examples already wired to this Actor's own input schema, see the [API](#api) section below.

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`).

# README

## Wikimedia Commons Image Downloader: Files with License & Credit

Use this tool to **download images from Wikimedia Commons** by search query, category or exact file title, and keep the **license, author and attribution text** next to every file. It is a **Wikimedia Commons image downloader** and a **free image downloader with license data**: you filter by license group (public domain, CC BY, CC BY-SA) and by minimum size, the files are saved with a public link, and every dataset row carries the credit line you need when you reuse the picture. It uses the official Wikimedia Commons API: no browser, no login, no API key.

> **What it does NOT do.** It only reads Wikimedia Commons (not Wikipedia articles, Flickr or other sites) and only downloads **images** (JPG, PNG, GIF, SVG, TIFF, WebP). It does not download video, audio or PDF files. The license and author fields are what the uploader entered on Commons: **this is not legal advice**, and some files carry extra restrictions (trademarks, personality rights, freedom-of-panorama limits) that a license label does not show. Check the file's `pageUrl` before commercial use. It does not scrape the Wikimedia sites (no HTML pages) and does not work around any block.

### What you get

- **The files:** saved in the run's key-value store, one public link per file (`fileUrl`), optionally converted and resized, optionally one ZIP.
- **The credit data:** `author`, `license`, `licenseUrl`, `licenseGroup`, `attributionText`, `description`, `dateCreated`, `categories` and the Commons page of each file (`pageUrl`).
- **A clear account of what happened:** one row per file with `status` (`downloaded`, `duplicate`, `skipped`, `failed`) and a reason, plus a `SUMMARY` record that counts what was left out before download (wrong license, too small, too large, not an image) so a small result is never a silent zero.

### How to download images from Wikimedia Commons

1. Put a topic in **Search queries** (`searchQueries`), for example `lighthouse sunset`, and/or category names in `categories`, and/or specific files in `fileTitles`.
2. Set **Max files** (`maxFiles`) and, if you need it, the license filter and a minimum width.
3. Run it. The dataset lists every file with its link and credit data. Turn on `zip` to also get `images.zip` with `manifest.csv` and `ATTRIBUTION.txt`.

### How to download only public domain or CC0 images from Commons

Set `"licenses": ["public-domain"]`. The group covers CC0 and public domain marks. Files whose license Commons does not list are left out when any license filter is set (counted in `SUMMARY`).

### How to download a whole Wikimedia Commons category

Give the category name in `categories` (with or without `Category:`) and raise `categoryDepth` to 1, 2 or 3 to include sub-categories (up to 100 categories per run). Many Commons categories hold only sub-categories, so depth 0 can return nothing; the row for that category tells you so.

### How to get the attribution text for a Commons image

Every row has `attributionText`, for example:
`"Cape May Lighthouse September 2020 002" by King of Hearts, CC BY-SA 4.0 (https://creativecommons.org/licenses/by-sa/4.0), via Wikimedia Commons (https://commons.wikimedia.org/wiki/File:...)`. It is built from the Commons data; check the license text for how the credit must be shown in your case. When you use `zip`, the same lines are in `ATTRIBUTION.txt` in the ZIP.

### Input example

```json
{
  "searchQueries": ["lighthouse sunset"],
  "licenses": ["public-domain", "cc-by", "cc-by-sa"],
  "minWidth": 800,
  "maxFiles": 5,
  "convertTo": "webp",
  "maxWidth": 1200,
  "zip": true
}
```

### Input

| Field | Default | What it does |
|---|---|---|
| `searchQueries` | none | Words searched in Commons file names, descriptions and categories. |
| `categories` | none | Commons categories, with or without `Category:`. |
| `fileTitles` | none | Exact `File:Name.jpg` titles or commons.wikimedia.org page links. Handled first. |
| `maxFiles` | 20 | Most files processed in the run (max 5,000). Only downloaded files are charged. |
| `categoryDepth` | 0 | Sub-category levels to read (0 to 3). |
| `maxFileSizeMb` | 25 | Larger files are left out (size as listed by Commons). |
| `licenses` | all | `public-domain`, `cc-by`, `cc-by-sa`, `other`. |
| `minWidth`, `minHeight` | 0 | Skip smaller images. Used in the Commons search and again on the file. |
| `fileTypes` | all six | `jpg`, `png`, `gif`, `svg`, `tiff`, `webp`. |
| `convertTo` | original | `jpg`, `png` or `webp` (Pillow). SVG stays SVG. Animations keep the first frame. |
| `maxWidth` | 0 | Shrink wider images (never upscales). 0 = original. |
| `quality` | 85 | JPG and WebP quality. |
| `dedupe` | true | Identical files (SHA-256) are delivered once; copies are free. |
| `zip`, `zipMaxMb` | false, 100 | Also make `images.zip` with a manifest and attribution list. |
| `outputStoreName` | none | Save files in a named key-value store that you keep. |
| `concurrency` | 3 | Parallel downloads (max 8). Low on purpose. |
| `perHostDelayMs` | 300 | Minimum gap between requests to one Wikimedia host. |
| `timeoutSecs` | 60 | Time allowed per download attempt (3 attempts). |
| `proxyConfiguration` | off | Optional proxy. Usually not needed. |

### Output example

One row per file (shortened; taken from a real run):

```json
{
  "title": "File:Phareétoilé (14542438125).jpg",
  "pageUrl": "https://commons.wikimedia.org/wiki/File:Phare%C3%A9toil%C3%A9_(14542438125).jpg",
  "status": "downloaded",
  "reason": "converted jpg to webp; resized to 1600px wide",
  "fileUrl": "https://api.apify.com/v2/key-value-stores/Gyv5JP0PMRBx9JPgH/records/88c463eb6b11e17d2583f45a90aaf7246d9b8f91debb453270986a9698d0c122.webp",
  "contentType": "image/webp",
  "sizeBytes": 118894,
  "width": 1600,
  "height": 930,
  "author": "maxime raynal from France",
  "license": "CC BY 2.0",
  "licenseCode": "cc-by-2.0",
  "licenseUrl": "https://creativecommons.org/licenses/by/2.0",
  "licenseGroup": "cc-by",
  "attributionRequired": true,
  "attributionText": "\"Phareétoilé (14542438125)\" by maxime raynal from France, CC BY 2.0 (https://creativecommons.org/licenses/by/2.0), via Wikimedia Commons (https://commons.wikimedia.org/wiki/File:Phare%C3%A9toil%C3%A9_(14542438125).jpg)",
  "dateCreated": "2014-06-30 02:34",
  "categories": ["Lighthouses in France", "Flickr images reviewed by FlickreviewR"],
  "source": "Category:Lighthouses in France",
  "index": 1
}
```

The `license`, `author` and `description` fields describe the **original** Commons file, also when you convert or resize it.

### How much does it cost

Pay per event, nothing for failed, skipped or duplicate files and nothing to start a run:

- `file`: **$0.0017** per file delivered (status `downloaded`).
- `megabyte`: **$0.0002** for every started megabyte of a delivered file beyond its first MB (1 MB = 1,000,000 bytes of the stored file, after any resize or conversion).

Examples:

- 1,000 files of 1 MB or less: 1,000 x $0.0017 = **$1.70**.
- 10,000 original photos averaging 3 MB: $17.00 for files + 10,000 x 2 x $0.0002 = $4.00, about **$21**.
- 100,000 files resized to WebP under 1 MB (`convertTo` + `maxWidth`): 100,000 x $0.0017 = **$170**.

Set the run's maximum charge in Apify to cap the spend: the Actor stops cleanly at the limit and says so in the status message.

### Use cases

- Collect free-to-use pictures for an article, blog or presentation, with the credit line ready.
- Build an image dataset (for example for ML) from public domain Commons categories.
- Mirror the images of a Commons category with their license metadata for an archive or catalogue.
- Check the license of a list of Commons files and download only the ones you may reuse.
- Fill a CMS or product database with illustrated entries that each carry an attribution text.

### FAQ

**Is every image free to use?** No. Commons holds free-licensed and public domain files, but each license has conditions (CC BY needs credit, CC BY-SA needs credit and sharing alike). The data here is as entered on Commons and can be wrong or incomplete. Use the license filter and read the file page.

**Why did I get fewer files than `maxFiles`?** The query or category had fewer matches, or the filters (license, size, type) removed them. `SUMMARY` lists how many files were left out and why. A single source reads at most 40 API pages.

**Does it search by meaning or only by words?** By the Commons search engine (words in titles, descriptions and categories). Relevance is Commons' own order.

**Which sites does it contact?** Only `commons.wikimedia.org` (API) and `upload.wikimedia.org` (files), with a descriptive User-Agent, low concurrency and a delay per host, as the Wikimedia policy asks. Files from any other host are never downloaded.

**Can it download video, audio or PDFs?** No, only the six image types.

**Does it need an API key or login?** No.

### Use with the Apify API, MCP, n8n and Make

Python:

```python
from apify_client import ApifyClient
run = ApifyClient("<APIFY_TOKEN>").actor("<username>/wikimedia-commons-image-downloader").call(
    run_input={"searchQueries": ["red fox"], "licenses": ["public-domain"], "maxFiles": 10})
for row in ApifyClient("<APIFY_TOKEN>").dataset(run["defaultDatasetId"]).iterate_items():
    print(row["fileUrl"], row["attributionText"])
```

JavaScript:

```js
import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: '<APIFY_TOKEN>' });
const run = await client.actor('<username>/wikimedia-commons-image-downloader').call({ searchQueries: ['red fox'], maxFiles: 10 });
const { items } = await client.dataset(run.defaultDatasetId).listItems();
```

The same input works from the Apify MCP server, the n8n and Make Apify modules and the REST API.

### Related tools

- **Download Images from URLs: Bulk Image & File Downloader** for direct image links and web pages.
- **Batch Image Converter & Resizer: WebP, AVIF, PNG & JPEG** to convert the delivered files further.
- **Image Info Checker: Dimensions, Format & Size from URLs** to check image URLs without downloading them.

### Credits

Data and files come from Wikimedia Commons (commons.wikimedia.org) under the license shown on each file page. Wikimedia and Wikimedia Commons are trademarks of the Wikimedia Foundation; this Actor is not affiliated with or endorsed by it.

# Actor input Schema

## `searchQueries` (type: `array`):

Words to search for in file names, descriptions and categories of Wikimedia Commons, one search per line. Example: lighthouse sunset. Each search fills the free space left by maxFiles.

## `categories` (type: `array`):

Categories to take files from, with or without the 'Category:' prefix. Example: Lighthouses in France. Only files filed directly in the category are taken unless you raise categoryDepth.

## `fileTitles` (type: `array`):

Specific files, as 'File:Name.jpg' or the commons.wikimedia.org/wiki/File:... page link. Example: File:Example.jpg. Handled first, 50 per API request.

## `maxFiles` (type: `integer`):

Most files processed in this run, all sources together (example: 20). Files beyond this are not downloaded and not charged. Only downloaded files are charged.

## `categoryDepth` (type: `integer`):

0 = only the category itself. 1 to 3 also read its sub-categories that many levels down (at most 100 categories per run). Example: 1.

## `maxFileSizeMb` (type: `number`):

Files larger than this are left out, judged from the size Commons lists. 1 MB = 1,000,000 bytes. Example: 10.

## `licenses` (type: `array`):

Keep only these license groups. Leave empty for all. public-domain covers CC0 and public domain marks; cc-by and cc-by-sa are the Creative Commons attribution licenses (any version); other covers GFDL, GPL, FAL and similar. Files whose license Commons does not list are kept only when the filter is empty.

## `minWidth` (type: `integer`):

Skip images narrower than this. 0 = no filter. Example: 800.

## `minHeight` (type: `integer`):

Skip images shorter than this. 0 = no filter. Example: 600.

## `fileTypes` (type: `array`):

Image types to download, taken from what Commons lists and checked again on the downloaded bytes. Search results for SVG vector drawings are only included when SVG is selected.

## `convertTo` (type: `string`):

Keep the original files, or convert raster images to JPG, PNG or WebP with Pillow. Transparency is flattened onto white for JPG. SVG files are kept as they are. Animations keep only the first frame. The credit data always describes the original file.

## `maxWidth` (type: `integer`):

Shrink images wider than this, keeping the aspect ratio (never upscales). 0 = original size. Example: 1600.

## `quality` (type: `integer`):

1 to 100, used when images are converted or resized to JPG or WebP. Example: 85.

## `dedupe` (type: `boolean`):

Files with identical content (SHA-256) are delivered once; later copies get status duplicate and are not charged.

## `zip` (type: `boolean`):

Also save all delivered files in one images.zip in the key-value store, with manifest.csv and ATTRIBUTION.txt inside and a public link in the SUMMARY record. The ZIP itself is free.

## `zipMaxMb` (type: `number`):

Files that would push the ZIP over this size are still saved and listed, but left out of the ZIP. Example: 100.

## `outputStoreName` (type: `string`):

Optional key-value store name, for example commons-lighthouses. Named stores are kept until you delete them, while a run's own store expires after your plan's retention period.

## `concurrency` (type: `integer`):

How many files are downloaded at the same time. Kept low on purpose: Wikimedia asks clients to be gentle. Example: 3.

## `perHostDelayMs` (type: `integer`):

Minimum time between two requests to the same Wikimedia host. At most 2 requests run at once per host. Example: 300.

## `timeoutSecs` (type: `integer`):

Time allowed for each download attempt. Failed requests are retried up to 3 times with backoff. Example: 60.

## `proxyConfiguration` (type: `object`):

Optional. Send requests through Apify Proxy or your own proxies. Usually not needed for Wikimedia. Each retry uses a new session.

## Actor input object example

```json
{
  "searchQueries": [
    "lighthouse sunset"
  ],
  "maxFiles": 5,
  "categoryDepth": 0,
  "maxFileSizeMb": 25,
  "licenses": [],
  "minWidth": 800,
  "minHeight": 0,
  "fileTypes": [
    "jpg",
    "png",
    "gif",
    "svg",
    "tiff",
    "webp"
  ],
  "convertTo": "original",
  "maxWidth": 0,
  "quality": 85,
  "dedupe": true,
  "zip": true,
  "zipMaxMb": 100,
  "concurrency": 3,
  "perHostDelayMs": 300,
  "timeoutSecs": 60,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `results` (type: `string`):

One row per Commons file (the default dataset) with license, author and attribution text, as JSON, CSV, Excel and more.

## `records` (type: `string`):

Key-value store records: the downloaded files, the run summary (SUMMARY) and the ZIP (images.zip) if requested.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "searchQueries": [
        "lighthouse sunset"
    ],
    "maxFiles": 5,
    "minWidth": 800,
    "convertTo": "original",
    "zip": true
};

// Run the Actor and wait for it to finish
const run = await client.actor("data-done-right/wikimedia-commons-image-downloader").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "searchQueries": ["lighthouse sunset"],
    "maxFiles": 5,
    "minWidth": 800,
    "convertTo": "original",
    "zip": True,
}

# Run the Actor and wait for it to finish
run = client.actor("data-done-right/wikimedia-commons-image-downloader").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "searchQueries": [
    "lighthouse sunset"
  ],
  "maxFiles": 5,
  "minWidth": 800,
  "convertTo": "original",
  "zip": true
}' |
apify call data-done-right/wikimedia-commons-image-downloader --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,data-done-right/wikimedia-commons-image-downloader"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/CM4UfZGQvhmO70gak/builds/UyQvJGA8Pi0syJdfm/openapi.json
