Introduction¶
DeepSeek Harness (DSH) follows an “everything is a plugin” architecture. Agent developers need to add panels in the sidebar, display results, and control workflows. The common approach is to build a standalone web page or script and then embed it into Harness via an iframe. This method requires dealing with cross-origin issues, path management, style isolation, and more, resulting in high development costs and awkward maintenance.
Below we introduce a DSH plugin: dsh-pindou-pattern. It provides a ready-made “Perler Bead Pattern Workshop” panel directly inside Harness, letting you chat and generate patterns in one place—no separate backend or frontend deployment needed.
What Is This¶
dsh-pindou-pattern is a DeepSeek Harness plugin developed by maintainer nanhaiya, categorized under “Model Inference.” Its core function: upload any image and generate a Perler bead pattern using MARD color codes. Users can set the grid size (number of cells), and export a printable pattern PNG along with a color code list CSV.
The same rendering engine and algorithms are available in three forms: a DSH plugin (sidebar panel), a single-file web page (just double-click to open), and a Windows desktop version (a ~900 KB single-file exe).
Core Features¶
1. Image to Pattern¶
Supports PNG / JPG / WebP formats. Three upload methods: click to browse, drag and drop onto the canvas, or simply Ctrl+V to paste a clipboard image.
2. Custom Size¶
Presets available: 25×25, 29×29, 48×48, 50×50, 64×64. You can also manually enter width and height values between 8 and 2000.
By default, the original image aspect ratio is locked. After uploading, the cell count is auto-calculated based on the image ratio (e.g., a 2:1 image becomes 25×13). Changing width or height adjusts the other dimension proportionally. Selecting a preset also calculates proportionally, so the image is never squashed or stretched.
Unlocking the ratio allows free width and height input; the image is then center-cropped (cover fit) without distortion.
When the grid exceeds 120 cells, the preview automatically switches to full-image mode.
3. MARD Official Color Codes¶
Includes the full 291-color palette (221 standard colors + 70 extended P/Q/R/T/Y/ZG colors). Toggle between “Standard 221” and “All 291.”
4. Controllable Color Count¶
Uses k-means clustering in Lab color space + nearest-color mapping to map image colors to MARD codes. Color cap ranges from 2 to 64 (default 24), avoiding the appearance of dozens of hard-to-find color codes in the finished piece.
5. Dithering & Background Removal (Optional)¶
Dithering: Uses Floyd–Steinberg serpentine error diffusion to trade graininess for detail—ideal for portraits and gradients.
Solid-color background removal: Automatically detects whether the image border is a solid color; if so, it’s removed and replaced with empty cells. Tolerance is adjustable (ΔE 0–60).
6. Canvas Preview¶
Each cell is labeled with its corresponding color code (on by default, toggleable), plus row and column numbers. An orange guide line appears every 5 cells for easy counting.
Colors auto-invert based on the background for readability. Supports 1×/2×/3× zoom. To ensure color codes remain legible, cells are never smaller than 20 px; wide images can scroll horizontally and auto-center.
7. Export Pattern PNG¶
Single-image export including: title + size/color count/total bead count + row and column numbers on all four edges + color code inside each cell + orange guide lines every 5 cells + color key legend (code + bead count, max 10 per row) + footer.
Layout strategy: Optimized for “largest possible cell size.” Cells cap at 60 px, and the total image is limited to 240 million pixels (long edge ≤ 30,000 px). For example: 50×50 → 60 px/cell, 300×300 → 51 px/cell, 500×500 → 30 px/cell, 500×303 → 39 px/cell—all color codes remain clearly readable.
8. Export Color List CSV¶
Format: code,hex,count + a TOTAL row. Includes UTF-8 BOM so Excel opens it without garbled characters.
File names use a unified prefix: pindou-<original_name>-<W>x<H>-mard.png / .csv.
9. UI & Settings¶
Bilingual interface (Chinese/English) with one-click switching. Supports light/dark theme auto-adaptation. Settings are auto-saved with one-click restore to defaults.
Installation & Activation¶
Install from npm (already published; will appear in the “Plugin Center” after installation):
dsh plugin --profile web add dsh-pindou-pattern
Or install directly from this repository’s source:
dsh plugin --profile web add github:nanhaiya/dsh-pindou-pattern
After installation, a “Perler Bead Pattern Workshop” entry will appear in the sidebar under “Global Panels” (positioned after “Agent”). Click to open the workspace.
Typical Workflow¶
- Upload an image (browse / drag & drop / Ctrl+V).
- Select size: Default is “Lock original aspect ratio”—after uploading, the cell count is auto-calculated from the image ratio (e.g., a 2:1 image becomes 25×13). Changing width or height adjusts the other dimension proportionally. Presets also calculate proportionally, so the image is never squashed or stretched.
To set a custom size, uncheck the lock and enter any width/height; the image will then be center-cropped (cover fit) without distortion. - Adjust colors: Toggle the color code range, drag the “Color Cap” slider, and enable dithering or background removal as needed.
- Click “Export Pattern” in the top-right to preview and download the PNG; click “CSV” to export the color list.
Each cell displays its MARD color code. The legend lists the bead count per color, sorted by count.
Use Cases & Notes¶
Ideal for converting images into Perler bead patterns, such as:
- Designers generating Perler bead color schemes;
- Craft enthusiasts creating Perler bead art;
- Educational demonstrations of image processing and color mapping algorithms.
The plugin runs with the current DSH process permissions. All image processing is done locally—no uploads, no network requests. Export files are generated by the local Canvas API.
Please review the source code and license before installing. The plugin is licensed under MIT.
Conclusion¶
dsh-pindou-pattern is a plugin that integrates “image to Perler bead pattern” capability directly into DSH, suitable for agent developers who need to generate printable patterns and color code lists. Once installed, it’s available in the sidebar with no additional deployment required.
- Plugin directory page: https://www.skillhub.cn/plugins/nanhaiya/dsh-pindou-pattern
- GitHub repository: https://github.com/nanhaiya/dsh-pindou-pattern