AI event ticket art with a working QR code: add the code after

Generate the ticket art without a code, then draw the QR or barcode on top with a library. A model-drawn code looks real but will not scan.

5 min readSume
All posts

For AI event ticket art with a working QR code, generate the ticket design with an empty square for the code, then draw the real QR or barcode on top with a library and test-scan it. Image models draw things that look like codes, but a pattern a model invents does not encode your ticket data.

Generate the ticket with a clear space

Ask for the layout: a perforated stub, a color band, a place for event name and a large blank white square for the code. Say that there must be no QR code, no barcode and no small text. Use a wide ratio such as 16:9 or 3:2.

curl -X POST https://api.sume.com/v1/images \
  -H "Authorization: Bearer $SUME_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"openai/gpt-image-2.5","prompt":"Concert ticket design, dark purple gradient, perforated stub on the right, large empty white square at the bottom left for a code, no text, no QR code, no barcode","quality":"high","aspect_ratio":"16:9"}'

Draw the code in code

Download data[0].url, then render a QR for the ticket id with a library such as qrcode and paste it into the white square. Keep a quiet zone of plain white around it, and print or display it large enough for the scanner. Sume's own guidance on this problem is in AI image with a working QR code.

import qrcode
from PIL import Image

ticket = Image.open("ticket.png").convert("RGB")
qr = qrcode.make("https://example.com/t/TICKET-0001").convert("RGB").resize((360, 360))
ticket.paste(qr, (80, ticket.height - 440))
ticket.save("ticket-0001.png")

Scan before you send

Scan every code with a phone at the size it will be seen. Test the darkest and busiest ticket in your set, since a code over a textured background can fail even when it is drawn correctly. Keep the white square flat and the contrast high.

Keep the art and the data apart

A ticket system needs one art file and many data rows. Generate the art once, or pick one from n: 4, then loop over your rows. This keeps spend at one image call, and a late change to a date is a re-render, not a new generation.

A checklist

  • Empty white square in the art, no code drawn by the model.
  • Code rendered from the ticket id with a library.
  • Quiet zone around the code, high contrast, tested by scan.
  • Event name and date set from data, not typed into the prompt.
  • Prompt, model id and job id stored with the template.

Related posts

More in Use cases

All Use cases posts

Written by Sume