Kazuki Yunome18 downloadsAutomatically generates markdown sidecars for images using a local Vision-Language Model.
Asset Weaver for Obsidian.md
An Obsidian plugin that autonomously scans your vault for untagged image assets and leverages a local Vision-Language Model (VLM) to generate structured markdown sidecar files. Perfect for creative professionals, artists, and researchers looking to weave their visual libraries into their knowledge graphs without relying on cloud APIs.
| Before (Image Only) | After (Weaved Metadata) |
|---|---|
![]() |
![]() |
📂 See the Library-Scale Transformation guide for before/after directory screenshots.
💡 Pro tip: See how to create Dataview galleries from your tagged assets — query by tags, categories, and more.
This plugin requires an OpenAI-compatible API endpoint that supports Vision capabilities. We highly recommend using a local VLM for privacy and cost-efficiency.
qwen2-vl-7b-instruct or llava).<->).1234).main.js, manifest.json, styles.css) from the Releases page.asset-weaver in your vault's .obsidian/plugins/ directory.Go to Obsidian Settings -> AssetWeaver Settings to configure the plugin:
http://localhost:1234/v1. For Ollama, use http://localhost:11434/v1.qwen2-vl:7b).lm-studio) for local servers, or your actual API key if using a remote service.11_assets_OB)..jpg, .png, .webp, etc.) into your designated Target Folder.Ctrl/Cmd + P) and run "Scan and weave new assets".During the development of this plugin, several edge cases were identified and resolved to ensure enterprise-grade stability:
Issue: Sending raw, high-resolution images (e.g., 4K photos or large screenshots) converted to Base64 resulted in massive payload sizes (7MB+). This frequently caused the local VLM server (LM Studio) to crash due to out-of-memory (OOM) errors or connection timeouts.
Solution: Implemented an internal HTML5 <canvas> API resizer. Before sending any request, the plugin automatically scales images down to a maximum of 768px and compresses them to JPEG. This reduces the payload size to mere kilobytes, ensuring rapid, stable inference without freezing the user's machine.
Issue: When analyzing screenshots containing text, VLMs often attempt to quote the extracted text directly in the JSON response (e.g., "description": "A screenshot of a "text" prompt."). This results in unescaped double quotes, causing JSON.parse to fail and the batch process to halt.
Solution: Applied strict prompt engineering explicitly forbidding unescaped double quotes, combined with a custom Regular Expression (jsonString.replace(...)) cleanup step that catches and sanitizes common escaping mistakes before parsing the JSON object.
Issue: Synchronization engines (like Syncthing) or clipboard failures sometimes leave invisible 0-byte .png placeholder files in the vault. Attempting to draw an empty blob to the HTML5 Canvas causes the img.onerror event to fire with a non-standard Event object, leading to confusing undefined error logs.
Solution: Added a strict pre-flight check (binary.byteLength === 0). The plugin gracefully catches 0-byte files, skips them safely, and notifies the user directly in the Obsidian UI exactly which file is corrupted.
Issue: Using Obsidian's standard app.metadataCache.resolvedLinks API failed to detect links pointing to images, as resolvedLinks only tracks Markdown-to-Markdown links.
Solution: Engineered a custom vault-wide scanner that iterates through all markdown files (app.vault.getMarkdownFiles()) and reads their individual metadata caches (cache.links and cache.embeds). This ensures that every single [[image.jpg]] or ![[image.jpg]] reference is accurately mapped and included in the sidecar's YAML linked_notes array.
AssetWeaver originated from an experimental Python-based image archival workflow initially developed to manage large-scale creative image collections inside Obsidian. That prototype informed the design and architecture of this Obsidian plugin.
AssetWeaverは、もともとObsidian内の大規模なクリエイティブ画像コレクションを管理するために開発された、実験的なPythonベースの画像アーカイブ・ワークフローに端を発します。そのプロトタイプでの知見が、本Obsidianプラグインの設計とアーキテクチャに活かされています。
...
本プラグインの開発過程で、安定性を高めるために解決したいくつかの技術的課題を紹介します:
課題: 高解像度の画像をそのままBase64変換して送信すると、ペイロードが巨大(7MB以上)になり、ローカルサーバーがクラッシュしたりタイムアウトしたりすることがありました。
解決策: HTML5 <canvas> APIを用いた内蔵リサイズ機能を実装。送信前に画像を最大 768px にリサイズ・JPEG圧縮することで、ペイロードを数百KBまで削減し、高速かつ安定した推論を実現しました。
課題: スクリーンショット内のテキストを読み取る際、AIがJSON文字列内でダブルクォーテーションをそのまま使ってしまい、パースエラーが発生することがありました。 解決策: プロンプトエンジニアリングによってクォーテーションの厳格な使用を指示。さらに、パース直前に正規表現によるクリーンアップ処理を挟むことで、AIの出力ミスを柔軟に吸収します。
課題: 同期エラー等で発生した中身が空(0バイト)の画像ファイルを読み込もうとすると、エラーが発生して処理が止まってしまうことがありました。 解決策: ファイル読み込み時にバイト数チェックを導入。破損ファイルを検知した場合は、ユーザーに通知を出した上で安全にスキップし、他の画像の処理を継続させます。
課題: Obsidian標準の resolvedLinks APIはMarkdown間のリンクしか保持しておらず、画像へのリンクを検出できませんでした。
解決策: Vault内の全Markdownファイルを走査し、メタデータキャッシュから直接画像への参照を抽出するカスタムスキャナーを構築。正確な linked_notes のリストアップを実現しました。
MIT License