/install doubaoimages
Doubao Local Image Saver
Use this skill when the user wants to:
- use 豆包网页生图
- save the final generated image to local disk
- get back the saved local file path
Inputs
Collect or infer:
prompt: image prompt for 豆包output_path: local save path
If the user does not specify an output path, default to a timestamped file name in:
C:\Users\Administrator\.openclaw\workspace mp\
Use this naming pattern:
doubao-YYYYMMDD-HHMMSS.png
Example:
C:\Users\Administrator\.openclaw\workspace mp\doubao-20260318-131500.png
Workflow
1) Open Doubao
Open:
https://www.doubao.com/chat/
Assume the user may already be logged in. Do not force re-login unless the page clearly requires it.
2) Submit the prompt
Preferred path:
- Focus the chat textbox
- Enter the prompt
- Send it
- Wait for generation to complete
If normal browser click/type fails on the textbox, use browser evaluate fallback.
Use this pattern when needed:
() => {
const ta = document.querySelector('textarea');
if (!ta) return { ok: false, reason: 'no textarea' };
const text = 'PROMPT_HERE';
const setter = Object.getOwnPropertyDescriptor(window.HTMLTextAreaElement.prototype, 'value').set;
setter.call(ta, text);
ta.dispatchEvent(new Event('input', { bubbles: true }));
ta.dispatchEvent(new Event('change', { bubbles: true }));
return { ok: true, valueLength: ta.value.length };
}
If Enter does not submit, click the likely send button near the lower-right side of the input area.
3) Extract the highest-quality image URL
Do not assume the first visible image URL is the original file. Visible Doubao images often use display URLs containing clues like:
downsizewatermark
Those are usually preview assets, not the best download source.
Use this priority order:
Priority A: use Doubao's native download flow
After generation completes:
- click the chosen generated image to open preview/lightbox
- look for a button whose text or label suggests
下载 - click that button if present
- if the browser exposes a direct URL, prefer that asset over page image URLs
Priority B: inspect preview-state DOM images
If preview opens but no explicit download button is found, inspect images again while the large preview is open. Prefer the image candidate with the largest natural dimensions.
Use this pattern:
() => {
return [...document.images]
.map((img, i) => ({
i,
src: img.src,
width: img.naturalWidth,
height: img.naturalHeight,
alt: img.alt || ''
}))
.filter(x => x.width > 100 && x.height > 100)
.filter(x => !x.src.startsWith('data:image/svg+xml'))
.sort((a, b) => (b.width * b.height) - (a.width * a.height));
}
Priority C: inspect page images and rank quality
If no preview/download path works, inspect normal page images and rank them. Use this pattern:
() => {
return [...document.images]
.map((img, i) => ({
i,
src: img.src,
width: img.naturalWidth,
height: img.naturalHeight,
alt: img.alt || '',
score: (img.naturalWidth * img.naturalHeight)
}))
.filter(x => x.width > 100 && x.height > 100)
.filter(x => !x.src.startsWith('data:image/svg+xml'))
.sort((a, b) => b.score - a.score);
}
Pick the best result by this order:
- native download result
- largest preview-state image URL
- largest page image URL without
downsize/watermark - if all page URLs are processed previews, use the largest one as fallback
When comparing URLs, prefer the one that:
- has the largest dimensions
- comes from preview/download state rather than the base chat card
- does not contain
downsize - if available, prefer
image_preor original image-generation asset URLs over tiny chat thumbnails - only accept
watermarkvariants when they are still the highest-quality accessible preview - looks like an original CDN asset rather than a transformed display asset
4) Save the image locally
Download the chosen URL directly to a local file.
If the user did not provide output_path, generate one with a timestamp first.
Use this pattern:
@'
from datetime import datetime
import pathlib
base = pathlib.Path(r'C:\Users\Administrator\.openclaw\workspace mp')
base.mkdir(parents=True, exist_ok=True)
out = base / f"doubao-{datetime.now().strftime('%Y%m%d-%H%M%S')}.png"
print(out)
'@ | python -
Then download to that path:
@'
import urllib.request
url = 'IMAGE_URL_HERE'
out = r'OUTPUT_PATH_HERE'
urllib.request.urlretrieve(url, out)
print(out)
'@ | python -
5) Return the local path
After saving, confirm the file exists and return:
- the final local save path
- optionally the original image URL if useful
Token-saving rules
To reduce token waste:
- do not repeatedly snapshot the full page unless the state is unclear
- after submit, wait briefly, then inspect DOM images directly
- prefer preview/download-state DOM inspection over repeated screenshots
- use direct download instead of screenshot cropping whenever possible
- only fall back to screenshot capture if no usable real image URL is available
Failure handling
Doubao not logged in
Ask the user to log in on the opened page, then continue.
No textarea found
Refresh once and retry. If still missing, inspect for iframe or layout change.
Only low-resolution preview URLs found
Try this sequence:
- click one generated image to open preview
- look for
下载button or download-style control - inspect preview-state DOM images and choose the largest candidate
- only if all URLs still contain transformed preview hints like
downsize/watermark, use the largest fallback URL
No final image URL found
Wait once more, inspect DOM again, then fall back to screenshot-based capture only if absolutely necessary.
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install doubaoimages - After installation, invoke the skill by name or use
/doubaoimages - Provide required inputs per the skill's parameter spec and get structured output
What is doubaoimg?
Generate images with Doubao web chat, extract the final generated image URL from the page, save the image locally, and return the saved local path. Use when... It is an AI Agent Skill for Claude Code / OpenClaw, with 208 downloads so far.
How do I install doubaoimg?
Run "/install doubaoimages" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is doubaoimg free?
Yes, doubaoimg is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does doubaoimg support?
doubaoimg is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created doubaoimg?
It is built and maintained by Likely7 (@likely7); the current version is v1.0.0.