Skip to content

fix: add screenshot max-size flag#428

Merged
thymikee merged 1 commit intomainfrom
fix/screenshot-max-size
Apr 18, 2026
Merged

fix: add screenshot max-size flag#428
thymikee merged 1 commit intomainfrom
fix/screenshot-max-size

Conversation

@thymikee
Copy link
Copy Markdown
Contributor

@thymikee thymikee commented Apr 18, 2026

Summary

Add screenshot --max-size <px> / maxSize support to downscale saved PNG screenshots by longest edge without new dependencies.

The resize runs in the runtime screenshot path before artifact publishing, preserves aspect ratio, only downscales, and round-trips through CLI/client/daemon replay scripts. Docs and the agent-device verification skill now mention the agent-friendly screenshot size option.

Closes #426

Validation

  • pnpm format
  • pnpm test:unit -- src/__tests__/runtime-public.test.ts src/__tests__/cli-client-commands.test.ts src/utils/__tests__/args.test.ts src/daemon/__tests__/context.test.ts src/daemon/handlers/__tests__/session-replay-script.test.ts src/daemon/__tests__/session-store.test.ts
  • pnpm check:quick
  • pnpm check:unit

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c91868c5e2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/utils/png.ts Outdated
Comment on lines +39 to +41
const sourceY = Math.floor((y * source.height) / height);
for (let x = 0; x < width; x += 1) {
const sourceX = Math.floor((x * source.width) / width);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Map resize samples to include image boundaries

The nearest-neighbor mapping uses Math.floor((coord * sourceSize) / targetSize), which never reaches the last source row/column when downscaling; for example, a 3→2 resize samples columns 0 and 1 but never 2. That means screenshot --max-size systematically drops right/bottom edge pixels and shifts content toward the top-left, which can hide edge UI details and skew visual artifacts. Use a boundary-preserving mapping (endpoint- or center-based) so both source edges are representable in the resized output.

Useful? React with 👍 / 👎.

@thymikee thymikee force-pushed the fix/screenshot-max-size branch 2 times, most recently from 46f632c to ebc5f63 Compare April 18, 2026 17:11
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 18, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://callstackincubator.github.io/agent-device/pr-preview/pr-428/

Built to branch gh-pages at 2026-04-18 17:26 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@thymikee thymikee force-pushed the fix/screenshot-max-size branch 2 times, most recently from 953b889 to 805df47 Compare April 18, 2026 17:18
@thymikee thymikee force-pushed the fix/screenshot-max-size branch from 805df47 to fe5e007 Compare April 18, 2026 17:25
@thymikee thymikee merged commit 57ba479 into main Apr 18, 2026
15 checks passed
@thymikee thymikee deleted the fix/screenshot-max-size branch April 18, 2026 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow resizing screenshots

1 participant