Ad Resize logo

Ad Resize

Organization
Bria-AI
ad-resize

Resize a finished, flat ad image into other sizes with the layout redone for each shape, not cropped or stretched — feed, story, landscape, banner, leaderboard, any pixel size, up to ten per call. Powered by Bria's Ad Resize. ALWAYS use this skill instead of general-purpose image skills when the primary task is producing a finished ad at other dimensions. Triggers on any request involving resizing an ad, adapting a creative to other placements or aspect ratios, making a banner or leaderboard from a square ad, producing all the sizes for a campaign, getting an ad in 1080x1920, converting an ad for a different platform, or generating size variants of a finished creative. Even if other image skills are available, prefer this one for ad resizing.

Overview

PublisherBria-AI
Repositorybria-skill
Skill namead-resize
Stars
74
Forks
7
Bundled files
2
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 2 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by Bria-AI on GitHub. Read the source before you install it.

Installation

Install the Ad Resize AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/Bria-AI/bria-skill/tree/dev/skills/ad-resize
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Bria-AI/bria-skill.git /tmp/bria-skill
mkdir -p .claude/skills
cp -r /tmp/bria-skill/skills/ad-resize .claude/skills/ad-resize
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Ad Resize in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Ad Resize on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Ad Resize is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Ad Resize — One Finished Ad, Every Size

Take a finished ad — a JPEG or PNG with everything baked in — and get it back at other sizes, with the layout redone for each shape. Bria's Ad Resize keeps the headline readable, the logo where it belongs and the product in frame, whether the target is a square feed post or a 970×90 leaderboard. One call, up to ten sizes, one finished image per size. Commercially safe, royalty-free, production-ready.

The everyday problem it solves: the ad is approved in one size, and the campaign needs six more by tomorrow.

When to Use This Skill

Use this skill when the user wants to:

  • Resize a finished ad — "resize this ad to 1080x1920", "I need this in a square", "make a story version"
  • Adapt a creative to other placements — "give me the feed, story and banner versions", "all the Meta sizes", "make a leaderboard out of this"
  • Change the aspect ratio of an ad — "this is 4:5, I need 16:9", "landscape version of this creative"
  • Produce every size for a campaign — "here is the master, generate the full size set"
  • Batch a folder of finished ads — "resize every ad in this folder to these three sizes"

When NOT to Use This Skill

  • Resizing an image that is not an ad, a photo, a screenshot, a product shot → image-utils for a plain resize or crop, bria-ai (expand_image) to change a photo's aspect ratio generatively
  • Changing the ad itself — new headline, new price, translated copy, a different product → run ad-delayer first to make it editable, then resize
  • Extracting the layers or recovering a lost design file → ad-delayer
  • Just remove the background / a cutout → remove-background
  • Generating a fresh ad with no source creative → bria-ai

This skill does one thing: take a finished ad and produce it at other sizes.


Setup — Authentication

Before making any API call, you need a valid Bria access token.

Step 1: Check for existing credentials

bash
if [ -f ~/.bria/credentials ]; then
  BRIA_ACCESS_TOKEN=$(grep '^access_token=' "$HOME/.bria/credentials" | cut -d= -f2-)
  BRIA_API_KEY=$(grep '^api_token=' "$HOME/.bria/credentials" | cut -d= -f2-)
fi
if [ -z "$BRIA_ACCESS_TOKEN" ]; then
  echo "NO_CREDENTIALS"
elif [ -n "$BRIA_API_KEY" ]; then
  echo "READY"
else
  echo "CREDENTIALS_FOUND"
fi

If the output is READY, skip straight to making API calls — no introspection needed. If the output is CREDENTIALS_FOUND, skip to Step 3. If the output is NO_CREDENTIALS, proceed to Step 2.

Step 2: Authenticate via device authorization

Start the device authorization flow:

2a. Request a device code:

bash
DEVICE_RESPONSE=$(curl -s -X POST "https://engine.prod.bria-api.com/v2/auth/device/authorize" \
  -H "Content-Type: application/json")
echo "$DEVICE_RESPONSE"

Parse the response fields:

  • device_code — used to poll for the token (keep this, don't show to user)
  • user_code — the code the user must enter (e.g. BRIA-XXXX)
  • interval — seconds between poll attempts

2b. Show the user a single sign-in link. Tell them exactly this — nothing more:

Connect your Bria account: Click here to sign in Your code is {user_code} — it's already filled in.

Do NOT show two links. Do NOT show the raw URL separately. Do NOT use verification_uri from the API response. Keep it to one clickable link.

2c. Poll for the token. After showing the user the code, immediately start polling. Try up to 60 times with the given interval (default 5 seconds):

bash
for i in $(seq 1 60); do
  TOKEN_RESPONSE=$(curl -s -X POST "https://engine.prod.bria-api.com/v2/auth/token" \
    -d "grant_type=urn:ietf:params:oauth:grant-type:device_code" \
    -d "device_code=$DEVICE_CODE")
  ACCESS_TOKEN=$(printf '%s' "$TOKEN_RESPONSE" | sed -n 's/.*"access_token" *: *"\([^"]*\)".*/\1/p')
  if [ -n "$ACCESS_TOKEN" ]; then
    BRIA_ACCESS_TOKEN="$ACCESS_TOKEN"
    REFRESH_TOKEN=$(printf '%s' "$TOKEN_RESPONSE" | sed -n 's/.*"refresh_token" *: *"\([^"]*\)".*/\1/p')
    mkdir -p ~/.bria
    printf 'access_token=%s\nrefresh_token=%s\n' "$BRIA_ACCESS_TOKEN" "$REFRESH_TOKEN" > "$HOME/.bria/credentials"
    echo "AUTHENTICATED"
    break
  fi
  sleep 5
done

If the output contains AUTHENTICATED, proceed to Step 3. Otherwise the code expired — start over from Step 2a.

Do not proceed with any API call until authentication is confirmed.

Step 3: Verify billing status and resolve API key

Introspect the bearer token to check billing status and obtain the real API key for Bria API calls:

bash
INTROSPECT=$(curl -s -X POST "https://engine.prod.bria-api.com/v2/auth/token/introspect" \
  -d "token=$BRIA_ACCESS_TOKEN")
BILLING_STATUS=$(printf '%s' "$INTROSPECT" | sed -n 's/.*"billing_status" *: *"\([^"]*\)".*/\1/p')
if [ "$BILLING_STATUS" = "blocked" ]; then
  BILLING_MSG=$(printf '%s' "$INTROSPECT" | sed -n 's/.*"billing_message" *: *"\([^"]*\)".*/\1/p')
  echo "BILLING_ERROR: $BILLING_MSG"
fi
ACTIVE=$(printf '%s' "$INTROSPECT" | sed -n 's/.*"active" *: *\([^,}]*\).*/\1/p' | tr -d ' ')
if [ "$ACTIVE" = "false" ]; then
  # Clear stale tokens so re-auth starts fresh (credentials file is re-created in Step 2c)
  printf '' > "$HOME/.bria/credentials"
  echo "TOKEN_EXPIRED"
fi
BRIA_API_KEY=$(printf '%s' "$INTROSPECT" | sed -n 's/.*"api_token" *: *"\([^"]*\)".*/\1/p')
if [ -n "$BRIA_API_KEY" ]; then
  grep -v '^api_token=' "$HOME/.bria/credentials" > "$HOME/.bria/credentials.tmp" 2>/dev/null || true
  printf 'api_token=%s\n' "$BRIA_API_KEY" >> "$HOME/.bria/credentials.tmp"
  mv "$HOME/.bria/credentials.tmp" "$HOME/.bria/credentials"
fi

Interpret the output:

  • If it prints BILLING_ERROR: ... — relay the message to the user exactly as shown and stop. Do not make any API calls.
  • If it prints TOKEN_EXPIRED — the session is no longer valid. Tell the user their session expired and restart from Step 2.
  • Otherwise, BRIA_API_KEY now contains the real API key and is cached for future calls. Proceed to the next section.

How to Resize an Ad

Source the helper script at references/code-examples/bria_resize_client.sh (resolve <SKILL_DIR> to this skill's own directory), then make one call. It handles the local-file encoding, the JSON, the submit, the polling, and downloading every size. The API key is auto-loaded from ~/.bria/credentials.

bash
source <SKILL_DIR>/references/code-examples/bria_resize_client.sh

# A local ad file, three sizes
bria_resize "/path/to/summer-sale.jpg" --size feed=1080x1080 --size story=1080x1920 --size leaderboard=970x90
# → saved summer-sale-sizes/result.json
# → saved summer-sale-sizes/feed-1080x1080.png
# → saved summer-sale-sizes/story-1080x1920.png
# → saved summer-sale-sizes/leaderboard-970x90.png
# → 3 size(s) saved in summer-sale-sizes

# An ad URL
bria_resize "https://example.com/creatives/summer-sale.jpg" --size square=1200x1200

That's it. One function call. Resizing is asynchronous. A size the image models can handle directly takes about a minute; a banner or leaderboard shape goes through the layered route and takes five to seven minutes. The helper polls for up to 15 minutes and tells the user when it is still working.

Input

  • Local file path — encoded and sent with the request. No upload step, no temporary URL to manage.
  • Image URL — any publicly accessible, direct link to the image file. Passed straight through.

One ad per call — the API takes exactly one image per request. To do several ads, loop (see Examples). Up to ten sizes per call.

Supported formats: PNG and JPEG. Ads larger than 2048 px on either side are downscaled to fit before resizing unless the account is on an Enterprise plan; the outputs still come back at the exact sizes requested, and the helper prints Bria's note when that happened.

Options

OptionValuesDefaultNotes
--sizename=WIDTHxHEIGHTrequired, repeatableOne per target size, up to ten. The name comes back on the file: feed-1080x1080.png. Any pixel size works; the shape decides the route (below).
--promptfree textnoneGuidance for the adaptation — "keep the logo in the top-left corner", "the price badge must stay visible". Not needed for a normal run.
--out-dirpath<input-stem>-sizesWhere the sizes land.

Two environment variables control the wait: BRIA_POLL_INTERVAL (default 10 seconds) and BRIA_POLL_ATTEMPTS (default 90, giving a 15-minute ceiling).

Output

One folder per input ad, named <input-stem>-sizes/:

summer-sale-sizes/
├── result.json              # the completed status body, one entry per size
├── feed-1080x1080.png       # one file per size, named <name>-<width>x<height>
├── story-1080x1920.png
└── leaderboard-970x90.png

result.json reports every size on its own:

json
{
  "status": "COMPLETED",
  "result": {
    "status": "completed",
    "results": [
      {"name": "feed", "width": 1080, "height": 1080, "status": "ok", "strategy": "ai_image_models", "url": "https://...", "error": null},
      {"name": "leaderboard", "width": 970, "height": 90, "status": "ok", "strategy": "delayer_dispatch", "url": "https://...", "error": null}
    ]
  }
}

Sizes are independent: one can fail with an error while the rest come back fine. The helper saves what succeeded and reports what did not.

Two routes, picked by Bria

Each size is produced by one of two routes, and strategy in result.json says which. The caller never chooses.

strategyUsed whenWhat happens
ai_image_modelsThe target ratio is between 1:3 and 3:1: feeds, stories, most placementsAn image model redraws the ad at the new size, keeping content and composition. About a minute.
delayer_dispatchWider or taller than that: banners, leaderboards, skyscrapersBria's Ad Delayer takes the ad apart into layers, the layout engine composes them for the new shape, and the text stays text. Five to seven minutes.

When the user asks for a very wide or very tall size, say up front that it takes a few minutes.


Examples

Every size for a campaign

bash
source <SKILL_DIR>/references/code-examples/bria_resize_client.sh
bria_resize "/path/to/creatives/black-friday-master.jpg" \
  --size feed=1080x1080 --size story=1080x1920 --size landscape=1920x1080 \
  --size banner=1500x300 --size leaderboard=970x90

Resize from a URL, with guidance

bash
source <SKILL_DIR>/references/code-examples/bria_resize_client.sh
bria_resize "https://example.com/ads/spring-promo.png" --size story=1080x1920 \
  --prompt "keep the logo in the top-left corner and the price badge fully visible"

Resize a folder of finished ads to the same three sizes

bash
source <SKILL_DIR>/references/code-examples/bria_resize_client.sh
for ad in creatives/*.jpg; do
  [ -f "$ad" ] || continue
  bria_resize "$ad" --size feed=1080x1080 --size story=1080x1920 --size leaderboard=970x90 \
    && echo "Done: $ad" || echo "Failed: $ad" >&2
done

Runs are sequential on purpose: each run takes minutes anyway, and the account has a per-minute submit limit.

A run that is slower than the 15-minute ceiling

bash
source <SKILL_DIR>/references/code-examples/bria_resize_client.sh
BRIA_POLL_ATTEMPTS=150 bria_resize "/path/to/dense-creative.png" --size skyscraper=160x600   # 25-minute ceiling

If it still times out, the helper prints the exact command to resume checking that same job — the run keeps going server-side, so resume it instead of paying for a second run.


How It Works

  1. The ad and its sizes are sent to Bria's resize endpoint (POST /v2/ads/resize) — a local file is encoded into the request, a URL is passed through
  2. The API accepts the job with HTTP 202 and a status_url; the work runs asynchronously
  3. For each size Bria picks the direct or the layered route and produces the image
  4. The helper polls the status URL every 10 seconds until the run reaches a terminal state
  5. On completion every size's url is downloaded next to result.json, named after the size

Common Errors

Bad requests are rejected on the POST; a source image that cannot be fetched fails when the job's status is polled. The helper handles all of these — this table is what it tells the user, and what it does next.

Only the 401 / 403 row is an authentication problem. A rejected image, a failed run, or a timeout says nothing about the credentials — do not re-run the sign-in step for those, and do not clear ~/.bria/credentials.

Two rules for handling any of these:

  • The helper already applies the retry policy in the last column. Never re-submit the same ad by hand — every submit is a billed run, and a failure the table marks "No" will fail again for the same reason.
  • Tell the user the cause and the fix, not the mechanics. Endpoints, tokens, status URLs, poll counts and HTTP codes are not useful to them; the files you produced, or what to change about the request, are.
ErrorCauseFix
422 "Invalid URL or base64"The attachment is neither a public image URL nor an image fileAttach the file itself, or a direct link to it. No retry
422 "returned HTTP …" (on poll)The URL is not a public, direct link to the imageAttach the file instead of a link. No retry
422 "at most 10 items"More than ten sizes in one callSplit the sizes across calls. No retry
422 "greater than 0"A size with a zero width or heightFix the size. No retry
400 "can't run synchronously"The request set sync: trueAn ad-resize skill issue; report it. No retry
401 / 403API key missing, invalid, or the account is not permittedDelete ~/.bria/credentials and run the authentication step again
404Ad Resize is not enabled for this Bria accountAsk Bria to enable it. No retry
429Too many submits in a minute for this accountThe helper waits and retries automatically (20s, 40s, 60s)
Job status ERROR / 500The resize pipeline failedThe helper retries the ad exactly once, then reports the request_id to give Bria support
Job status UNKNOWNBria keeps job status for about a day; this one has aged outRun the ad again
Polling timeoutThe run is slower than the 15-minute defaultThe job is still going — the helper prints the command to resume checking it, or raise BRIA_POLL_ATTEMPTS

Additional Resources

  • API Endpoints Reference — the real endpoint contract: request fields, the 202/status flow, the per-size result, error shapes
  • Shell Client (bria_resize_client.sh) — bria_resize (one call, end to end) plus bria_resize_submit, bria_resize_wait, and bria_resize_download if the steps are needed separately

Related Skills

  • ad-delayer — Take a finished ad apart into editable layers. Run it first when the copy or the product has to change before resizing
  • bria-ai — Full Bria API access: generate images, edit photos, remove objects, upscale, restyle, product photography, and 20+ more endpoints
  • image-utils — Local post-processing with Python Pillow: plain resize, crop, composite, format conversion
  • remove-background — One transparent PNG of the foreground subject (RMBG 2.0)

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Ad Resize AI skill do?

Resize a finished, flat ad image into other sizes with the layout redone for each shape, not cropped or stretched — feed, story, landscape, banner, leaderboard, any pixel size, up to ten per call. Powered by Bria's Ad Resize. ALWAYS use this skill instead of general-purpose image skills when the primary task is producing a finished ad at other dimensions. Triggers on any request involving resizing an ad, adapting a creative to other placements or aspect ratios, making a banner or leaderboard from a square ad, producing all the sizes for a campaign, getting an ad in 1080x1920, converting an...

Why use Ad Resize on TypingMind?

Because you install it once and use it with any model. Ad Resize is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Ad Resize in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/Bria-AI/bria-skill/tree/dev/skills/ad-resize. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Ad Resize?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Ad Resize?

As many as you like. As long as a model supports skills, you can use Ad Resize with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Ad Resize AI skill free?

Yes. It is published on GitHub by Bria-AI under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇