#[agents/tool-images] Image resized to fit limits

1 messages · Page 1 of 1 (latest)

jaunty geyser
#

How can I reduce the frequency of this Image resize event occurring? Also I think the image is resent turn after turn and I'd like to limit the number of turns an image is resent.

fallow yewBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

zenith wyvernBOT
#

That log line is coming from OpenClaw’s image sanitization step (agents/tool-images). It fires whenever an image that’s about to be included in a model request is over the limits (by default max side = 1200px and max bytes ≈ 5MB), so OpenClaw recompresses/downscales it and logs:

Image resized to fit limits: ...

1) Reduce how often “Image resized
” happens

A) Make the source images smaller (best fix)

  • If the images come from nodes:camera_snap, set maxWidth / quality on the tool call so it produces smaller images up-front.
  • If they’re screenshots/photos you upload, pre-scale them (or convert PNG → JPEG) before sending.

B) Raise the sanitization limit (if you’re okay with bigger images)

You can bump the threshold so fewer images trigger resizing:

openclaw config set agents.defaults.imageMaxDimensionPx 1600
# then restart gateway
openclaw gateway restart
#

Notes:

  • Default is 1200.
  • Going much above ~2000px can cause some providers to reject multi-image requests, so increase in small steps (1600 → 1800 → 2048) and see what your model/provider tolerates.

C) If you only care about log noise

Set your log level higher (this hides a lot of other info logs too):

openclaw config set logging.level warn
openclaw config set logging.consoleLevel warn
openclaw gateway restart

Docs: https://docs.openclaw.ai/logging

2) “Is the image resent turn after turn?”

Often, yes — if the image remains in the prompt/history, the gateway has to re-include it when constructing each new model request. OpenClaw already prunes some historical user-image blocks after they’ve been processed once, but tool-result images (e.g. camera snapshots returned as tool results) can stick around in history and get re-sent.

#

Practical workarounds today:

  • After the agent has “seen” the image and produced a text description, start a fresh session and continue from the description.
  • If it’s a tool producing the image, adjust the workflow so the tool sends the image outward (as an attachment) and the model keeps only a text summary in the transcript.

If you paste one of the resize log lines including the { label: ... } field (e.g. prompt:images vs nodes:camera_snap), I can tell you exactly which path is causing the repeated re-send in your case.

jaunty geyser
#

I'm taking screenshots then pasting them into a webchat (control ui) based session. I did not find any prompt:images or nodes:camera_snap is the logs, but here's a full log line: 2026-03-07T20:38:59-07:00 clawd node[1798479]: 2026-03-08T03:38:59.681Z [agents/tool-images] Image resized to fit limits: 1791x825px 182.6KB -> 52.7KB (-71.1%). It's reducing the amount of turns an image is resent that I'm after.

zenith wyvernBOT
#

That log line is exactly what happens when a pasted screenshot gets turned into an image block for the model and then sanitized:

  • default limit is 1200px max side (agents.defaults.imageMaxDimensionPx)
  • your screenshot is 1791×825, so it gets recompressed/downscaled and you see:
    Image resized to fit limits: 1791x825px ...

Why it feels like it’s “resent every turn”

In the Control UI path, OpenClaw can end up re-loading images from the transcript/prompt on subsequent turns (because the attachment is still represented in the conversation context). If that happens, you’ll see the same resize message again on later turns, and yes — the model is effectively getting that image again.

Right now there isn’t a config knob like “only resend images for N turns”.

What you can do today

Option A (most reliable): treat images as one-shot

After the assistant has answered using the screenshot:

  • /new to start fresh (fast + guaranteed the image won’t be included again)
#
  • or /compact once you’ve got the useful text out of the image (keeps the session but summarizes older turns, which usually drops the heavy attachment markers)

Docs: https://docs.openclaw.ai/help/faq#how-do-i-start-a-fresh-conversation

Option B: reduce the pain (even if it still resends)

If you mostly just hate the resizing / quality loss, set the max dimension above your typical screenshot width so it won’t trigger for ~1800px images:

openclaw config set agents.defaults.imageMaxDimensionPx 1800
openclaw gateway restart

This does not stop resends, but it will stop the resize event for images up to that size.

Option C: confirm whether it’s coming from “prompt:images”

If you tail JSON logs you can see the structured fields (the console/syslog line doesn’t show them):

#
openclaw logs --follow --json

If you paste one JSON log entry for a resize event (it’ll include fields like label, fileName, triggerOverDimensions, etc.), I can tell you definitively whether it’s being reloaded from prompt history vs coming from some tool result. If it’s the “reloaded from history” case, that’s a good candidate for a GitHub issue/feature request (“only load media refs from the most recent user turn” or “prune media refs after first model pass”).

jaunty geyser
#

How about this one:
{"_TRANSPORT":"stdout","__MONOTONIC_TIMESTAMP":"1595854450675","_COMM":"openclaw-gatewa","_BOOT_ID":"xyz","MESSAGE":"2026-03-01T04:43:26.585Z [agents/tool-images] Image resized to fit limits: 1901x1131px 179.3KB -> 62.2KB (-65.3%)","_CAP_EFFECTIVE":"0","_SELINUX_CONTEXT":"unconfined\n","_UID":"1000","__REALTIME_TIMESTAMP":"1772340206585742","_SYSTEMD_UNIT":"user@1000.service","_SYSTEMD_USER_UNIT":"openclaw-gateway.service","_PID":"882653","_SYSTEMD_USER_SLICE":"app.slice","SYSLOG_FACILITY":"3","_HOSTNAME":"clawd","_SYSTEMD_CGROUP":"/user.slice/user-1000.slice/user@1000.service/app.slice/openclaw-gateway.service","_RUNTIME_SCOPE":"system","__SEQNUM":"1180654","PRIORITY":"6","SYSLOG_IDENTIFIER":"node","_SYSTEMD_OWNER_UID":"1000","_MACHINE_ID":"...94acb","_SYSTEMD_INVOCATION_ID":"...66c99d","__CURSOR":"s=d3c4c...08235f5b8120;i=1203ee;b=f5...4f46e85d;m=17390566ff3;t=64bef1c6f478e;x=2016b323106b4494","_EXE":"/usr/bin/node","_CMDLINE":"openclaw-gateway","_SYSTEMD_SLICE":"user-1000.slice","__SEQNUM_ID":"...235f5b8120","_STREAM_ID":"19b3a8e3a29...3bcd","_GID":"1000"}

zenith wyvernBOT
#

Yep — that journald JSON blob is still just the console-formatted log line in MESSAGE, so it doesn’t include the structured fields (label, fileName, triggerOverDimensions, etc.) that would tell us why it’s being loaded again.

First: this resize line alone doesn’t prove “resent every turn”

It only proves: at that timestamp, an image was present in the LLM request and exceeded the default 1200px limit.

To confirm re-sending, the key test is:

  1. Paste screenshot once, ask your question (you’ll see the resize log).
  2. Next turn send text-only (“ok thanks, now do X”).
  3. If you still see another Image resized to fit limits log on that text-only turn → the screenshot is being re-attached from history/prompt scanning.

How to get the details we need (with label)

Use OpenClaw’s JSONL log stream (not journald):

openclaw logs --follow --json
#

Then paste the log event where subsystem is agents/tool-images. That entry will include a label like prompt:images, nodes:camera_snap, or read:/... and we’ll know exactly what pipeline is reintroducing it.

If your goal is “don’t resend the screenshot after it’s been used”

Right now there’s no config knob for “keep images for N turns”.

Workarounds that actually stop repeats:

  • After the screenshot is processed, do /new (guaranteed).
  • Or do /compact once the assistant has described the screenshot in text (often drops old attachment refs from the prompt/history).

If you just want to stop the resize (your example is 1901px wide)

You can raise the dimension limit above your typical screenshot width:

openclaw config set agents.defaults.imageMaxDimensionPx 2048
openclaw gateway restart
#

That won’t change re-sending behavior, but it will stop the resize event for ~1900px screenshots.

If you run the “text-only follow-up” test above and paste the corresponding openclaw logs --follow --json entry, I can tell you whether it’s being pulled from prompt:images (prompt scanning of old “[media attached 
]” lines) vs. something else.

jaunty geyser
#

How about:
{"type":"log","time":"2026-03-07T20:15:12.772-07:00","level":"info","subsystem":"agents/tool-images","message":"{"subsystem":"agents/tool-images"} {"label":"session:history","sourceMimeType":"image/png","sourceWidth":1804,"sourceHeight":1145,"sourceBytes":262996,"maxBytes":5242880,"maxDimensionPx":1200,"triggerOverBytes":false,"triggerOverDimensions":true,"outputMimeType":"image/jpeg","outputBytes":61474,"outputQuality":85,"outputMaxSide":1200,"byteReductionPct":76.6} Image resized to fit limits: 1804x1145px 256.8KB -> 60.0KB (-76.6%)","raw":"{"0":"{\"subsystem\":\"agents/tool-images\"}","1":{"label":"session:history","sourceMimeType":"image/png","sourceWidth":1804,"sourceHeight":1145,"sourceBytes":262996,"maxBytes":5242880,"maxDimensionPx":1200,"triggerOverBytes":false,"triggerOverDimensions":true,"outputMimeType":"image/jpeg","outputBytes":61474,"outputQuality":85,"outputMaxSide":1200,"byteReductionPct":76.6},"2":"Image resized to fit limits: 1804x1145px 256.8KB -> 60.0KB (-76.6%)","_meta":{"runtime":"node","runtimeVersion":"24.14.0","hostname":"unknown","name":"{\"subsystem\":\"agents/tool-images\"}","parentNames":["openclaw"],"date":"2026-03-08T03:15:12.771Z","logLevelId":3,"logLevelName":"INFO","path":{"fullFilePath":"file:///home/hunter/openclaw-app/node_modules/openclaw/dist/subsystem-BfkFJ4uQ.js:426:51","fileName":"subsystem-BfkFJ4uQ.js","fileNameWithLine":"subsystem-BfkFJ4uQ.js:426","fileColumn":"51","fileLine":"426","filePath":"openclaw-app/node_modules/openclaw/dist/subsystem-BfkFJ4uQ.js","filePathWithLine":"openclaw-app/node_modules/openclaw/dist/subsystem-BfkFJ4uQ.js:426","method":"logToFile"}},"time":"2026-03-07T20:15:12.772-07:00"}"}

zenith wyvernBOT
#

Perfect — this one answers the mystery.

"label":"session:history" means: the screenshot isn’t just “attached to the current prompt”, it’s sitting inside the persisted session transcript/history, and every new turn the gateway re-sanitizes that history before sending it to the model.

So two important implications:

  1. Why you see the resize log repeatedly
    OpenClaw is resizing at send time (sanitizing the transcript) and doesn’t write the resized JPEG back into the stored session JSONL, so the next turn it encounters the original 1804×1145 PNG again and resizes again.

  2. Why it gets resent turn-after-turn
    If it remains in session:history, it’s going back to the model each request (unless something prunes it out).

What you can do (today) to stop re-sends

A) Use /new after the screenshot turn (guaranteed)

Once you’ve gotten the answer that depends on the screenshot, send /new and continue. That’s the only 100% way right now.

B) Use /compact after the screenshot has been “turned into text”

#

Ask the assistant to summarize what matters from the screenshot, then run /compact. Compaction tends to drop bulky historical blocks (including image blocks) because it replaces older turns with a summary.

What should happen automatically (and might be missing/buggy in your build)

There’s a history-prune path intended to replace already-processed user image blocks with:

[image data removed - already processed by model]

If you do the “text-only follow-up” test and it still logs session:history resizes, that suggests one of:

  • you’re on a version/build where that prune isn’t present or isn’t persisting, or
  • the image isn’t in a user message (e.g. it’s in a toolResult / other role), which currently won’t get pruned.

If you paste:

  • openclaw --version
  • and (if possible) whether you see that marker string anywhere in the session after an image turn


I can tell which case you’re in and whether it’s worth filing an issue (“prune toolResult image blocks” / “persist sanitized images into transcript” / “prune user images in Control UI sessions”).

jaunty geyser
#

version 2026.3.2
{"type":"log","time":"2026-03-07T22:44:50.378-07:00","level":"info","subsystem":"agents/tool-images","message":"{"subsystem":"agents/tool-images"} {"label":"session:history","sourceMimeType":"image/png","sourceWidth":1223,"sourceHeight":110,"sourceBytes":29982,"maxBytes":5242880,"maxDimensionPx":1200,"triggerOverBytes":false,"triggerOverDimensions":true,"outputMimeType":"image/jpeg","outputBytes":13420,"outputQuality":85,"outputMaxSide":1200,"byteReductionPct":55.2} Image resized to fit limits: 1223x110px 29.3KB -> 13.1KB (-55.2%)","raw":"{"0":"{\"subsystem\":\"agents/tool-images\"}","1":{"label":"session:history","sourceMimeType":"image/png","sourceWidth":1223,"sourceHeight":110,"sourceBytes":29982,"maxBytes":5242880,"maxDimensionPx":1200,"triggerOverBytes":false,"triggerOverDimensions":true,"outputMimeType":"image/jpeg","outputBytes":13420,"outputQuality":85,"outputMaxSide":1200,"byteReductionPct":55.2},"2":"Image resized to fit limits: 1223x110px 29.3KB -> 13.1KB (-55.2%)","_meta":{"runtime":"node","runtimeVersion":"24.14.0","hostname":"unknown","name":"{\"subsystem\":\"agents/tool-images\"}","parentNames":["openclaw"],"date":"2026-03-08T05:44:50.378Z","logLevelId":3,"logLevelName":"INFO","path":{"fullFilePath":"file:///home/hunter/openclaw-app/node_modules/openclaw/dist/subsystem-BfkFJ4uQ.js:426:51","fileName":"subsystem-BfkFJ4uQ.js","fileNameWithLine":"subsystem-BfkFJ4uQ.js:426","fileColumn":"51","fileLine":"426","filePath":"openclaw-app/node_modules/openclaw/dist/subsystem-BfkFJ4uQ.js","filePathWithLine":"openclaw-app/node_modules/openclaw/dist/subsystem-BfkFJ4uQ.js:426","method":"logToFile"}},"time":"2026-03-07T22:44:50.378-07:00"}"}

zenith wyvernBOT
#

Nice — this confirms it 100%.

  • You’re on 2026.3.2
  • The resize is happening while sanitizing label: "session:history"
  • That means the image is still present in the stored transcript history, so it’s getting included again on later turns (and re-resized each time the history is prepared for a model call).

Why it keeps happening

OpenClaw’s sanitizer resizes for the outbound request, but it doesn’t persist the resized JPEG back into the session transcript. So the next turn, it sees the original image/png block in history again → resizes again → logs again.

How to actually stop “resend every turn”

There isn’t currently a “keep images for N turns” knob. If the image is in session:history, the only practical ways to stop it from being re-sent are:

  1. /new after you’re done with the screenshot (guaranteed)
  2. /compact after the assistant has converted what matters into text
    (Tip: compaction often keeps the last few turns verbatim; so do /compact once the screenshot turn is no longer in the last couple turns, or after a couple more exchanges.)

How to reduce resize frequency (even if it still resends)

#

Your example is barely over the default 1200px (1223×110). If you bump the limit, that whole class of “almost-1200px” images will stop triggering:

openclaw config set agents.defaults.imageMaxDimensionPx 2048
openclaw gateway restart

This looks like a legit bug/feature gap

There is code intended to prune already-processed user image blocks from history, but your logs show the image is still surviving into session:history.

If you want this fixed upstream, I’d file a GitHub issue with:

  • the structured log entry you pasted (showing label:"session:history")
  • “pasted image via Control UI / chat.send attachments”
  • and whether it still happens after the assistant has already replied to the image turn

Issue tracker: https://github.com/openclaw/openclaw/issues

jaunty geyser
#

If I set: openclaw config set agents.defaults.imageMaxDimensionPx 2048
the image is still going to get resent each turn right? This setting just suppresses the resize action and log message for images up to 2048px in one dimension?

zenith wyvernBOT
#

Yes — it’ll still get resent as long as that image block is still present in session:history.

agents.defaults.imageMaxDimensionPx only affects the sanitization step (“do we downscale/recompress this image before sending it to the model?”). It does not change whether the image is included in the prompt/history.

So with:

openclaw config set agents.defaults.imageMaxDimensionPx 2048

you’re essentially doing two things:

  • Suppress resize + the resize log for images where both sides are <= 2048px (and they’re not otherwise over size limits).
  • You’re still going to include that image in every request if it remains in the session transcript.

Two extra nuances:

#
  • There’s also a bytes limit (you can see maxBytes: 5242880 in your log). If an image is over ~5MB, it can still get recompressed even if dimensions are under the pixel limit.
  • Stopping re-sends requires removing it from history: /new (guaranteed) or /compact (often effective once the image turn is no longer “recent”).
jaunty geyser
#

OK I got it about /new stopping re-send but that's not always what I want right after or shortly after pasting an image. I guess I can't have my cake and eat it too 🙂

zenith wyvernBOT
#

You actually can get pretty close to “cake and eat it too” — just not instantly.

Practical workflow: keep the session, stop resending the image shortly after

  1. Paste screenshot, ask what you need.
  2. Next message ask for a text-only capture of anything you’ll want to reference later, e.g.:

“Summarize the screenshot in text (key fields + any numbers). After this, assume the image is gone.”

  1. After 1–2 more turns (so the image turn isn’t “super recent” anymore), run:
/compact Keep the screenshot summary and the current plan. Drop any image data/attachments.

Because compaction persists a text summary and discards older raw content, it’s the cleanest way to keep continuity while getting rid of the image payload sitting in session:history.

Optional tuning (if you do this constantly)