vsdx-shrinker
Remove unused master shapes from Visio (.vsdx) files to dramatically reduce file size.
The Problem
Visio files can become bloated when you copy-paste content from PDFs, vector graphics, or other sources. Each paste operation can create "master shapes" that remain in the file even after you delete the visible content. These orphaned masters can make your file 10x larger than necessary.
How It Works
VSDX files are ZIP archives containing XML. This tool:
- Extracts the VSDX file
- Scans page content to find which masters are actually referenced (via
USE("...")patterns) - Removes unreferenced masters from
masters.xmland deletes their XML files - Repacks the cleaned archive
Installation
pip install vsdx-shrinker
Or with uv:
uv tool install vsdx-shrinker
Usage
Command Line
Shrink a file (creates backup):
vsdx-shrinker diagram.vsdx
Shrink to a new file:
vsdx-shrinker diagram.vsdx -o diagram_small.vsdx
Analyze without modifying:
vsdx-shrinker diagram.vsdx --analyze
Python API
from vsdx_shrinker import shrink_vsdx, analyze_vsdx
# Analyze a file
result = analyze_vsdx("diagram.vsdx")
print(f"Can save {result['potential_savings_mb']} MB")
# Shrink a file
result = shrink_vsdx("diagram.vsdx", output_path="diagram_small.vsdx")
print(f"Reduced by {result['reduction_percent']}%")
CLI Options
usage: vsdx-shrinker [-h] [-o OUTPUT] [--no-backup] [--analyze] [-q] [--version] input
positional arguments:
input Input .vsdx file path
options:
-h, --help show this help message and exit
-o, --output OUTPUT Output file path (default: overwrite input with backup)
--no-backup Do not create backup when overwriting input file
--analyze Only analyze the file, do not modify
-q, --quiet Suppress output except errors
--version show program's version number and exit
Example Output
$ vsdx-shrinker presentation.vsdx --analyze
Analysis of: presentation.vsdx
Total masters: 244
Used masters: 6
Unused masters: 238
Potential savings: 79.17 MB
$ vsdx-shrinker presentation.vsdx -o presentation_clean.vsdx
Shrunk: presentation.vsdx
Original size: 14.8 MB
New size: 1.6 MB
Reduction: 13.2 MB (89.2%)
Masters removed: 238
Output: presentation_clean.vsdx
License
MIT
Metadata
Release files for vsdx-shrinker 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| vsdx_shrinker-0.1.2.tar.gz | 8.1 kB | With provenance | Details for vsdx_shrinker-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| vsdx_shrinker-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for vsdx_shrinker-0.1.2-py3-none-any.whl |
Total release size: 16.6 kB
Release files / vsdx_shrinker-0.1.2.tar.gz
| Download URL | vsdx_shrinker-0.1.2.tar.gz |
|---|---|
| Size | 8.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f355670b86ebbacea957c16fad3000d489100ed4d197907df68e1a87f2e37976
|
|
BLAKE2b-256 checksum How to use checksums |
e15fb74d18e6d2a1b0d5b2de228872c6fb4e7c952a3a62fa97cd6c5d91c262b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 8, 2026.
Transparency logRelease files / vsdx_shrinker-0.1.2-py3-none-any.whl
| Download URL | vsdx_shrinker-0.1.2-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5983ece5e51188d2bfa0e2ff4c7763e042b74634696e56994c329d4136be60d1
|
|
BLAKE2b-256 checksum How to use checksums |
8b1eeb38f1ed0b68849eb68bc5bb572e2fe82a8c598600cc58e7e89f8e96c794
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 8, 2026.
Transparency logSecurity for vsdx-shrinker 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for vsdx_shrinker-0.1.2.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 8, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.