A Python script that organizes images in Obsidian vaults by moving them into assets
folders next to the Markdown files that reference them.
- Automatically finds all Markdown files and images in your Obsidian vault
- Creates
assets
folders next to Markdown files that use images - Moves images to their corresponding
assets
folders - Preserves image dimensions in Obsidian's internal links
- Supports PNG, JPG, JPEG, GIF, and BMP files
-
Make the script executable:
chmod +x organize_images.py
-
Run the script from your Obsidian vault directory:
./organize_images.py
Before:
vault/
├── note.md
└── image.png
After:
vault/
├── note.md
└── assets/
└── image.png
The reference in note.md
will be updated from ![[image.png]]
to ![[assets/image.png]]
.
- Python 3.6 or higher
- Standard library only (no external dependencies)