Skip to content

Pad charts from a post with a white margin for social posts - #119

Merged
MaxGhenis merged 4 commits into
mainfrom
social-image-white-margin
Nov 21, 2026
Merged

MaxGhenis merged 4 commits into
mainfrom
social-image-white-margin

Conversation

@MaxGhenis

@MaxGhenis MaxGhenis commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Adds a short section to the policyengine-content skill: when a social post or newsletter attaches a chart, map or table from the post, put it on a white canvas with a margin of about 6% of its width on every side. The PIL helper pad_white(source_path, output_path) writes a padded copy, so the original stays editable and a rerun adds no second border, and it pastes through the alpha channel so transparent areas come out white. The section asks for a check of the destination's preview, since a feed's crop can still clip a wide figure.

Max asked for this after the Veterans Day posts went out with charts shot flush to the figure edge.

Tests: CI passes at 03730a2 (test, manifest on Python 3.11 and 3.15, skill-examples). The snippet runs as written on transparent RGBA, opaque RGB and palette PNGs: each goes from 1,200 × 630 to 1,344 × 774 with white corners, and the source file stays unchanged.

🤖 Generated with Claude Code

MaxGhenis and others added 4 commits November 12, 2026 11:02
…ocial posts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
pad_white now saves to a separate output path, so the original stays editable and a rerun adds no second border. The skill no longer promises the margin survives every crop and asks for a preview check instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@MaxGhenis
MaxGhenis marked this pull request as ready for review November 21, 2026 13:06
@MaxGhenis
MaxGhenis merged commit b90b114 into main Nov 21, 2026
4 checks passed
@MaxGhenis

Copy link
Copy Markdown
Contributor Author

Merged at the reviewed head 03730a2 with every check passing. Independent review: round 1 raised a P1 (transparent areas turned black), fixed in 779078b; round 2 raised a P1 (the prose overclaimed what the margin protects) and a P2 (the helper overwrote its source), fixed in 03730a2; scoped round 3 approved with no new findings.

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.

1 participant