AI baby announcement card via API: art from the model, name from code

Make a baby announcement card: generate illustrated art at 3:4, crop to 5x7, and set the name, date and weight in code. Plus a privacy check on photo URLs.

5 min readSume
All posts

For a baby announcement card, generate illustrated art with an empty panel for the text, then set the baby's name, birth date and weight in code. Illustration needs no photo of the child, which also sidesteps the fact that a reference photo has to be sent as a public HTTPS URL.

Sume's Image API takes 3:4 and 2:3 ratios but no 5:7. Generate at 3:4 and crop to 5x7 in code.

Think before you upload a photo

Sume's docs say reference images must be public HTTPS URLs; localhost, private-network and signed or private URLs are rejected. That means any photo you pass as a reference is reachable by anyone who has the link while the job runs. For a newborn's photo, use a link you can delete straight afterwards, or skip the photo and use illustration only.

Cropping 3:4 to 5x7

A 5x7 portrait card is a 5:7 ratio, narrower than 3:4. Cropping the width of a 3:4 image to 5:7 keeps the full height and trims the sides.

On a 2448x3264 image (the largest legal 3:4 size for gpt-image-2.5 in Sume's documented rule) the 5:7 crop is 2331 pixels wide, so about 117 pixels come off the sides, split between left and right. Keep the subject in the middle and the empty text panel inside the crop.

3:4 art cropped to a 5x7 card (read 2026-10-04)
StepValue
Generate3:4 art, such as 2448x3264 (7,990,272 pixels)
Crop to 5:7about 2331 x 3264
Pixels per inch on 5 x 7about 466 across, 466 down

Request and text layer

Ask for several takes, choose one, then draw the card text on top.

{
  "model": "openai/gpt-image-2.5",
  "prompt": "Soft watercolour of a sleeping fox cub curled in a nest of leaves, pastel sage and peach, empty cream space in the lower third. No lettering.",
  "aspect_ratio": "3:4",
  "n": 4
}

Set the wording in code

This runs as is on a placeholder canvas; open the chosen art in its place.

from PIL import Image, ImageDraw, ImageFont

card = Image.new("RGB", (2331, 3264), (250, 244, 232))  # replace with the cropped art
draw = ImageDraw.Draw(card)
font = ImageFont.load_default()
for y, line in [(2500, "Welcome, Alex"), (2580, "Born October 1"), (2660, "3.4 kg")]:
    draw.text((card.width // 2, y), line, fill=(70, 70, 60), font=font, anchor="mm")
card.save("announcement.png")
print(card.size)

Sources

Related posts

More in Use cases

All Use cases posts

Written by Sume