Skip to content

Conversation

@marcandreuf
Copy link

@marcandreuf marcandreuf commented Nov 21, 2025

Description

Fixes #583

This PR adds a --screenshot-format configuration option that allows users to set a default image format (png, jpeg, or webp) for the take_screenshot tool when no explicit format parameter is provided.

This is particularly useful for Claude Code users who experience issues with PNG screenshots not displaying correctly - they can now configure JPEG as the default format server-wide instead of having to specify it in every screenshot call.

Changes

  • Added --screenshot-format CLI option with choices: png, jpeg, webp (default: png)
  • Updated take_screenshot tool to use the configured default format when no format parameter is provided
  • Added troubleshooting documentation for Claude Code screenshot display issues

Note: This PR is the clean cut of the PR #587 with only me as a contributor so that the CLA and all the checks can be passed. See the rest of the discussions in PR #587

@marcandreuf
Copy link
Author

By the way, I am testing this fix locally while working on my projects and the claude.md instructions are not really followed all the time. The most reliable way is to add the settings into the ~/.claude.json as defined in the Readme.md of this fix.

README.md Outdated
> PNG is the default format as it provides lossless screenshots. JPEG typically produces smaller file sizes than PNG, which improves performance when working with screenshots. WebP offers the best compression while maintaining quality.
> [!NOTE]
> **Claude Code users**: If you experience issues with screenshots not displaying correctly, you can work around this by:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's move this into troubleshooting.md

Copy link
Author

Choose a reason for hiding this comment

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

done

README.md Outdated

### Configuring default screenshot format

You can set a default image format for all screenshots using the `--screenshot-format` option. The default is PNG. You can change it to JPEG or WebP if needed:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think we need an explicit example in the readme, let's remove it and rely on the CLI docs and --help examples.

Copy link
Author

Choose a reason for hiding this comment

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

done

src/cli.ts Outdated
screenshotFormat: {
type: 'string',
describe:
'Default image format for screenshots. Options: png, jpeg, webp. Default is png.',
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's clarify that this is for screenshots taken by take_screenshot if no format is supplied to the tool call.

Copy link
Author

Choose a reason for hiding this comment

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

done

@OrKoN
Copy link
Collaborator

OrKoN commented Nov 21, 2025

Please update the PR description as it does not sounds correct.

}

const format = request.params.format;
const quality = format === 'png' ? undefined : request.params.quality;
Copy link
Collaborator

Choose a reason for hiding this comment

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

please revert removal of this logic.

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.

Bug: take_screenshot returns wrong MIME type for PNG format

2 participants