When DSH is used together with LM Studio, image attachments generated by the read_image tool can sometimes be rejected by LM Studio’s openai-completions route, with the error message 'url' field must be a base64 encoded image. The dsh-read-image-jpeg-fallback plugin is designed to solve this transport-layer format compatibility issue.
This is a zero-configuration DSH image compatibility layer plugin. It hooks into DSH’s tools/post-execute hook after the read_image tool runs, converting PNG/WebP image blocks visible to the model into opaque sRGB JPEGs, while JPEGs and other media types remain unchanged.
Core Features¶
- Format conversion: Converts
image/pngandimage/webpattachments into opaque sRGB JPEGs. - Compatibility passthrough: Leaves JPEG and other media types unchanged.
- Zero configuration: No configuration file changes or scripts are required.
- Hook mechanism: Uses DSH’s
tools/post-executehook to perform transparent conversion.
Installation and Activation¶
The plugin requires DSH 0.1.1-rc.2, Node.js >= 22, and sharp 0.35.3. Install it with the following command:
dsh plugin --profile web add dsh-read-image-jpeg-fallback
After installation, restart DSH Web.
Typical Usage¶
Usage is identical to the native read_image tool. The plugin runs automatically in the background and, when it detects PNG/WebP images, generates a JPEG replacement for the model to use. No new tools need to be called or agent workflows modified.
Use Cases and Notes¶
- Use cases: The main model supports image input and you are using LM Studio’s OpenAI-compatible interface;
read_imagefails when building the next model request. - Notes: This plugin is a media format compatibility layer, not a vision model or OCR plugin. If conversion fails, the plugin uses a Fail Open strategy: it preserves the original
read_imageresult and logs a warning, without causing the tool call to fail. - Environment requirements: Confirmed to work on Windows.
Conclusion¶
While preserving the native DSH multimodal workflow, the plugin resolves transport-layer format mismatches. It may become unnecessary as upstream support improves.