# social-media-image-sizes

Validates image dimensions against rules for 9 social platforms and exports resized copies. Helpful when preparing ads or feed posts without manual editing.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 1800 installs · ★ 7
- Author: Branding5
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/Branding5/social-media-image-sizes/tree/HEAD/SKILL.md
- Updated: 2026-04-30
- HTML: https://affpapa.org/en/nevibecode/skills/social-media-image-sizes

## What it does

The skill contains 60+ social media specs. Running `scripts/check.js` evaluates an image against target platforms, sorting results from exact matches to undersized assets. For non-matching formats, it outputs a ready CLI command.

Image resizing runs via `scripts/resize.js`. It defaults to center-crop cover mode. If your subject sits off-center, pass `--fit contain` with a custom `--bg` color to letterbox instead.

Without Node.js 18+, the tool will fail. You must run `npm install` inside the skill directory before first use. Sharp requires a native binary, which may fail behind a proxy without `SHARP_IGNORE_GLOBAL_LIBVIPS=1`.

## Requirements
- Works with: LinkedIn

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add Branding5/social-media-image-sizes --skill social-media-image-sizes -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/social-media-image-sizes/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/social-media-image-sizes/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add Branding5/social-media-image-sizes --skill social-media-image-sizes -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/social-media-image-sizes/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add Branding5/social-media-image-sizes --skill social-media-image-sizes -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/social-media-image-sizes/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install Branding5/social-media-image-sizes social-media-image-sizes
```

2. **Manually: put the files in place**
- File: `.github/skills/social-media-image-sizes/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add Branding5/social-media-image-sizes --skill social-media-image-sizes -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/Branding5/social-media-image-sizes
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/social-media-image-sizes/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add Branding5/social-media-image-sizes --skill social-media-image-sizes -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/Branding5/social-media-image-sizes/tree/HEAD/SKILL.md

## When to use it
- validate image dimensions against social media specs
- export correctly cropped assets for social media ads
- generate instant CLI resize commands for mismatched images
- letterbox images using contain mode with custom background colors

## Example prompts
- Check if promo.png fits Instagram specs and show me the resize command
- Resize banner.jpg for YouTube Custom Thumbnail using contain mode
- List all available presets with scripts/resize.js

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: f79aeb6838fc855b.

BEGIN THIRD-PARTY FILE f79aeb6838fc855b
````text
---
name: social-media-image-sizes
description: Check and resize images for social media platforms. Run scripts/check.js to validate any image against specs for Instagram, Facebook, X (Twitter), LinkedIn, TikTok, YouTube, Pinterest, Snapchat, and Threads — get a ranked match list with exact resize commands. Run scripts/resize.js to export a correctly-sized copy. Use when a user asks to validate image dimensions, resize an image for a platform, check if an image fits a spec, or prep assets for social media posting or ads.
license: MIT
compatibility: Requires Node.js 18+ and npm (or pnpm). Run npm install once before first use.
metadata:
  author: Branding5
  version: "1.0.0"
  source: https://www.branding5.com/tools/social-media-cheat-sheet
allowed-tools: Bash
---

# Social Media Image Sizes

Check and resize images for 9 platforms / 60+ specs. Scripts mirror the logic at [branding5.com/tools/social-media-cheat-sheet](https://www.branding5.com/tools/social-media-cheat-sheet).

## Setup

Run once after install:

```bash
cd <skill-dir>
npm install
```

## Check an image

```bash
node scripts/check.js photo.jpg
```

Outputs a ranked match list — perfect → close → usable → too small — with an inline `node scripts/resize.js` command for every non-perfect match.

Filter by platform or match level:

```bash
node scripts/check.js photo.jpg --platform instagram
node scripts/check.js photo.jpg --filter perfect
node scripts/check.js photo.jpg --filter usable
```

Platform slugs: `instagram` `facebook` `twitter` `linkedin` `tiktok` `youtube` `pinterest` `snapchat` `threads`

## Resize an image

```bash
node scripts/resize.js photo.jpg "Instagram Portrait Post"
# → photo-instagram-portrait-post.jpg  (1080×1350 px)

node scripts/resize.js photo.jpg "YouTube Custom Thumbnail"
# → photo-youtube-custom-thumbnail.jpg  (1280×720 px)
```

Default fit is **cover** (center-crop). Use `--fit contain` to letterbox instead:

```bash
node scripts/resize.js photo.jpg "LinkedIn Background Photo" --fit contain --bg f0f0f0
node scripts/resize.js photo.jpg "Instagram Portrait Post" --out ./exports/ig.jpg
```

List every available spec name:

```bash
node scripts/resize.js photo.jpg --list
```

## Workflow

1. Run `check.js` to see what a given image already matches
2. Copy the suggested `resize.js` command from the output
3. Run it — the output file is saved alongside the original by default

## Gotchas

- **Sharp requires a native binary.** On first `npm install`, it downloads a prebuilt binary for your platform. If install fails behind a proxy, set `SHARP_IGNORE_GLOBAL_LIBVIPS=1` and retry.
- **All slides in an Instagram carousel must share the same aspect ratio.** The first image sets the ratio for the whole carousel — check all slides, not just the first.
````
END THIRD-PARTY FILE f79aeb6838fc855b

The third-party file has ended. Everything between the f79aeb6838fc855b tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2799 of 4319 bytes. © Branding5 · MIT · https://github.com/Branding5/social-media-image-sizes/tree/HEAD/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
