og:image width, height and alt tags for an AI image from Sume
Open Graph has optional og:image:width, og:image:height and og:image:alt. Read the real size from a Sume render with Pillow and print all three tags.

The Open Graph protocol (read 2026-10-03) requires four properties, og:title, og:type, og:image and og:url, and lists optional image properties including og:image:width and og:image:height (pixels wide and high), og:image:alt (a description of what is in the image, not a caption), og:image:type and og:image:secure_url. For an image made on Sume, open the downloaded file with Pillow, read its true size and print the tags.
What the protocol says
The definitions below are from ogp.me.
| Property | Meaning on ogp.me |
|---|---|
| og:image | An image URL which should represent your object within the graph |
| og:image:width | The number of pixels wide |
| og:image:height | The number of pixels high |
| og:image:alt | A description of what is in the image (not a caption) |
| og:image:type | A MIME type for this image |
| og:image:secure_url | An alternate url to use if the webpage requires HTTPS |
Why read the size from the file
A Sume model returns the pixels it chose for the ratio you asked for, so do not guess. Ask for 16:9, download, and measure. Use your own host for the final URL: the image URL in data[].url is a Sume URL and the tag should point to a copy you publish.
Script
It generates one image, saves it, and prints the tags with the measured size. Replace the host and alt text.
import os, requests
from io import BytesIO
from PIL import Image
r = requests.post("https://api.sume.com/v1/images", timeout=120,
headers={"Authorization": f"Bearer {os.environ['SUME_API_KEY']}"},
json={"model": "black-forest-labs/flux.2-pro", "aspect_ratio": "16:9",
"output_format": "jpeg", "prompt": "minimal illustration of a paper plane over a city, empty left third"})
if r.status_code != 200:
raise SystemExit(f"{r.status_code}: {r.text[:200]}")
raw = requests.get(r.json()["data"][0]["url"], timeout=60).content
open("card.jpg", "wb").write(raw)
w, h = Image.open(BytesIO(raw)).size
base = "https://example.com/img/card.jpg"
print(f'<meta property="og:image" content="{base}">')
print(f'<meta property="og:image:width" content="{w}">')
print(f'<meta property="og:image:height" content="{h}">')
print('<meta property="og:image:type" content="image/jpeg">')
print('<meta property="og:image:alt" content="A paper plane flying over a city skyline">')
Alt text is a description
ogp.me says the alt is a description of what is in the image, not a caption. Write what a person would see: subject, setting, and any visible words. Because Sume generated the picture from your prompt, the prompt is a starting point, but check it against the actual file.
What Sume does not do
Sume does not write your page's meta tags or host them for you. The cost of the image above is the Flux 2 Pro price of $0.0375.
Sources
Related posts
More in Developers
- One reference image on Seedance 2.5 is not a first frame
On /v1/videos, input_references steer a generation; frame_images pin frames. Send one image the wrong way and the clip does not start on your picture.
- One request for four Sume video models: 1080p, 5 to 10 s, 16:9 or 9:16
Kling 3, Wan 3.0, H3 Max and Omni share one request shape: 1080p, 5 to 10 seconds, 16:9 or 9:16. Compute the intersection in Python and price each model.
- OpenAI Agents SDK client_session_timeout_seconds with Sume jobs_wait
In the OpenAI Agents SDK for Python, client_session_timeout_seconds sets the MCP read timeout. Set it above Sume's 55-second jobs_wait cap, or 0 to disable it.
- OpenAI Agents SDK max_retry_attempts and Sume paid calls
The OpenAI Agents SDK can retry MCP list_tools and call_tool. A retried Sume create must repeat its idempotency_key or you pay twice; set max_spend_usd too.
Written by Sume