Skip to content

mw wiki file download

Releasev0.35.0 · cfeceb67

mw wiki file download FILE [flags]

Download a wiki filename (with or without File:) or a file-description URL. File-description URLs infer –wiki when it is omitted. The default format, original, preserves the uploaded bytes.

–format png or jpeg downloads MediaWiki’s rendered preview and encodes the requested format locally. SVG rendering happens on the wiki; local conversion accepts PNG, JPEG, GIF and WebP previews. Conversion exports a single still image. PNG preserves transparency; JPEG uses a white background.

–width sets the exact converted width in pixels and preserves the aspect ratio, even when the wiki returns a larger thumbnail. The default is the source width, or 1024 pixels when unknown. Large images may require a smaller width.

The default output filename is based on the wiki filename with the converted extension. Existing files require –overwrite. Use –output - to write file bytes to standard output.

Guide: mw help guides wiki files

--format <string>
Output format: original, png, or jpeg Default: original.
-o, --output <string>
Output path (default: wiki filename with the selected extension); - writes to stdout
--overwrite
Replace an existing output file
--width <int>
Exact converted width in pixels, preserving aspect ratio (0 uses the source width)
--anon
Use anonymous access instead of saved credentials
--help
Help for this command
--no-interaction
Do not ask any interactive questions
--password <string>
Wiki login password (or bot password)
--password-file <string>
Read the login password from a file
--profile <string>
Saved profile name or REALM/NAME
--realm <string>
Shared-login realm (wikimedia and wikibase-world are built in)
--username <string>
Wiki login username (use Name@bot for a bot password)
-v, --verbose <count>
Increase output verbosity. Example: --verbose=2 or -vv
--wiki <string>
Wiki URL or API endpoint
Terminal window
# Convert a Commons SVG preview to PNG
mw wiki file download 'https://commons.wikimedia.org/wiki/File:Logo_of_a-wikimedia-cli.svg' --format png --width 1024 --output logo.png
# Download the original uploaded file
mw wiki file download 'Logo_of_a-wikimedia-cli.svg' --wiki commons.wikimedia.org
Report an issue with this page

Report a documentation issue

The report includes this page’s link, section and documentation version.

Review and submit on Phabricator, or run the command using your saved CLI profile. The command asks before creating the task.