haperone151 downloadsLocal PNG/JPEG compression,using system pngquant/mozjpeg. Works offline, supports batch/background compression, cache with backups, and safe move of compressed files.
Compress PNG and JPEG files directly in your Obsidian vault on your computer, without cloud services or APIs. Reduce the disk space used by images by 30–70% without sacrificing quality.
Read in your language: English • العربية • Deutsch • Español • فارسی • Français • Bahasa Indonesia • Italiano • Nederlands • Polski • Português • Português (Brasil) • Русский • ไทย • Türkçe • Українська • Tiếng Việt • 日本語 • 한국어 • 中文简体 • 中文繁體

imagequant WASM pipeline)mozjpeg WASM pipeline)WebP, GIF, BMP, HEIC/HEIF, and AVIF are intentionally skipped in this release because the plugin does not include encoders for those formats.
| Setting | Description | Type/range | Default |
|---|---|---|---|
| PNG quality (min-max) | Quality range for lossy PNG quantization | 1-100 (e.g. 65-80) |
65-80 |
| JPEG quality | JPEG compression quality | 1-95 | 85 |
| Allowed roots | Relative paths where compression is allowed. Empty = entire vault | list of strings | empty |
| Output folder | Folder where compressed files are saved | string | Compressed |
| Auto-compress new files | Compress new images when they are added | boolean | false |
| Background compression | Compress in the background when inactive | boolean | true |
| Background threshold | Number of uncompressed images required to start background compression automatically | 10-1000 | 50 |
| Inactivity threshold | Minutes without user activity before background compression starts | 1-60 minutes | 2 |
| Auto backup retention | Automatically delete old pre-move backups | boolean | false |
| Keep backups, days | Delete move backups older than N days when automatic retention is enabled | 1-365 | 30 |
| Auto-move compressed files | Move compressed files back to the original image locations on startup, replacing the originals | boolean | false |
| Auto-move threshold | Number of compressed files ready to move that triggers auto-move | 1-1000 | 50 |
Compressed folder while preserving the original path structure.Compressed back to their original locations when the original is inside an allowed root. A backup is created before moving.Minimum sizes for compression: very small files are usually skipped (<5KB for PNG and <10KB for JPEG).
Internal safety limits are fixed: files larger than 100 MB are skipped before reading, and images above 100 million pixels are skipped after header validation.
Vault/.local-image-compress/backups/cache/; up to 50 files are kept.Vault/.local-image-compress/backups/originals/; created before the originals are replaced.Compressed meets or exceeds the threshold.This plugin temporarily disables the third-party plugin obsidian-paste-image-rename while compressing or moving files. This protection cannot be turned off because mapping compressed output to its original depends on newly created files not being renamed by another plugin.
Why it is needed:
vault.on("create") handler that fires for every image added to the vault within about one second of creation. It always acts on files whose name starts with Pasted image , and on all other images when its "Handle all attachments" option is enabled.Error: No active file found notice for every created file, flooding the interface with errors during batch processing.How this is handled safely:
obsidian-paste-image-rename is affected, and only during compression or move operations.app.plugins API because no public equivalent exists. Calls are guarded by feature detection, and errors are handled gracefully.main.js; images are not uploaded.Vault/.local-image-compress/backups/.obsidian-paste-image-rename may be temporarily disabled during compression or move operations, as described above, and is then restored with ownership checks.65-80, JPEG 75-90.files/ or images/.The plugin reports that the WebAssembly modules failed to initialize. Reload the plugin. If the error occurs again, include your Obsidian version, platform, and console error in the bug report.
Where are compressed files stored?
They are stored in Compressed by default. To replace the originals, use “Move compressed files”.
How are savings calculated? Savings are exact when the cache contains the original and output sizes. For uncompressed PNG/JPEG files, the plugin uses conservative estimates with capped ratios; the current sizes of compressed files are read from disk when needed.
GPL-3.0-or-later. Third-party licenses and notices: THIRD_PARTY_NOTICES.md.