JSON Image Decomposition: Produce Precise Email Banner Variations Without Rebuilding From Scratch
What This Builds
You upload a hero image or email banner to Gemini and ask it to map every visual element into a JSON object: the headline text, its color and font weight, the background color, the CTA button color, any product shots or decorative elements, and their approximate positions. Then you edit only the fields you want to change, paste the modified JSON back, and Gemini re-generates the image with surgical precision.
The result: a repeatable, documented editing process for every campaign banner you produce. Swap the sale percentage from "20% off" to "30% off" without touching anything else. Shift the button from coral to navy for a holiday color scheme. Generate three A/B visual variants in 20 minutes instead of briefing a designer and waiting two days.
Prerequisites
- Gemini account at gemini.google.com — free tier works for basic edits; Advanced ($20/month) produces noticeably better adherence to complex JSON schemas
- An existing email banner or hero image (PNG or JPEG) ready to use
- AI Studio (aistudio.google.com) bookmarked as a free backup when Gemini quota runs low
- Comfortable with copy-pasting JSON (no coding required — just editing text values)
The Concept
When you describe an image in free text, AI models have to guess. "Change the button to blue and update the sale amount" sounds clear to you. But the model might adjust the button color, shift the button's position, change the background tint, or accidentally alter the headline font weight — because nothing in free text tells it exactly what to leave alone.
JSON fixes this. When you force the model to first describe every element as a named field in a structured object, you get a complete, machine-readable map of the image. Every change you make in that map is explicit. Every element you don't touch is an implicit instruction to leave it exactly as it is.
Think of it as a blueprint for the image. Architects don't describe a building in prose when they want to change the paint color — they update the spec sheet. This workflow gives you a spec sheet for your email creative.
Build It Step by Step
Part 1: Extract the JSON Blueprint From Your Banner
Open Gemini at gemini.google.com. Upload your email banner image. Then paste this extraction prompt:
Analyze this email banner image and output a complete JSON object describing every visual element.
For each element, include these fields:
- "element": a short descriptive name (e.g., "hero_headline", "cta_button", "background", "product_image")
- "type": the element type ("text", "button", "image", "shape", "overlay")
- "content": the visible text or a description of the visual content
- "color": the primary color as a hex code or plain color name
- "background_color": background fill if applicable (use "transparent" if none)
- "font_weight": for text elements ("bold", "regular", "light")
- "position": approximate position on the canvas ("top-left", "center", "bottom-right", etc.)
- "size": relative size ("large", "medium", "small", "full-width")
Return only the JSON. No explanation, no markdown fencing — just the raw JSON array.
Gemini will return something like this (simplified example for a seasonal sale banner):
[
{
"element": "background",
"type": "shape",
"content": "solid fill",
"color": "#F5E6D3",
"background_color": "transparent",
"font_weight": null,
"position": "full-canvas",
"size": "full-width"
},
{
"element": "eyebrow_text",
"type": "text",
"content": "Limited Time",
"color": "#8B4513",
"background_color": "transparent",
"font_weight": "regular",
"position": "top-center",
"size": "small"
},
{
"element": "hero_headline",
"type": "text",
"content": "20% Off Everything",
"color": "#1A1A1A",
"background_color": "transparent",
"font_weight": "bold",
"position": "center",
"size": "large"
},
{
"element": "subheadline",
"type": "text",
"content": "This weekend only — use code SAVE20",
"color": "#4A4A4A",
"background_color": "transparent",
"font_weight": "regular",
"position": "center-below-headline",
"size": "medium"
},
{
"element": "cta_button",
"type": "button",
"content": "Shop Now",
"color": "#FFFFFF",
"background_color": "#D4562A",
"font_weight": "bold",
"position": "bottom-center",
"size": "medium"
}
]
Copy this entire JSON block and save it. This is your master blueprint.
Part 2: Make a Surgical Edit
Decide exactly what you want to change. Edit only those fields. Leave everything else identical.
Example: Update the sale amount and promo code for a follow-up campaign
Change these two lines:
"content": "30% Off Everything",
"content": "This weekend only — use code SAVE30",
Nothing else changes. The background stays warm cream. The button stays coral. The font weights stay the same. The positions stay the same.
Example: Generate a holiday color variant for A/B testing
Change the background and button:
"color": "#0D2B3E", // background — deep navy instead of warm cream
"background_color": "#C8102E", // cta_button — holiday red instead of coral
You now have two versions of the JSON. Each takes about 90 seconds to create.
Part 3: Re-Apply the Modified JSON to the Original Image
Open a fresh Gemini conversation (this matters — starting fresh prevents the model from inheriting assumptions from the extraction step). Upload the original banner image again. Paste this prompt, with your modified JSON below it:
Modify this image based on the following JSON specification. Each element in the JSON describes a visual component of this image. Apply only the changes specified — do not alter any element that is not explicitly different from what you see in the current image.
[paste your modified JSON here]
Gemini will re-generate the banner with only the fields you changed. The composition, layout, and all untouched elements remain in place.
Part 4: Iterate and Save Your JSON Library
Because the blueprint is plain text, you can maintain a folder of JSON files — one per campaign template. Next quarter's sale campaign starts from last quarter's JSON, not from scratch.
Suggested naming: banner-seasonal-sale-v1.json, banner-welcome-series-hero.json, banner-abandoned-cart-urgency.json
When a designer updates your master template, run the extraction prompt again and save the new JSON as v2. You now have version control for your email creative in a format any team member can edit.
Real Example: Three A/B Visual Variants for a Black Friday Campaign
Setup: You have a Black Friday hero image — dark background, gold "50% Off Sitewide" headline, white CTA button with black fill, product shot in the top-right quadrant.
Step 1 — Extract. Upload to Gemini, run the extraction prompt. You get a JSON with 6 elements: background, eyebrow label, hero_headline, product_image, subheadline, cta_button.
Step 2 — Create Variant A (control, unchanged). Keep the original JSON as-is. This is your control.
Step 3 — Create Variant B (urgency reframe). Edit two fields:
hero_headline.content: "50% Off — Ends Tonight"cta_button.content: "Claim Your Deal"
Step 4 — Create Variant C (color reframe). Edit background and button:
background.color: "#1C1C1C" (slightly lighter dark for contrast)cta_button.background_color: "#C8102E" (red urgency instead of black)
Step 5 — Generate all three. Three fresh Gemini conversations, original image uploaded to each, one JSON per conversation. Total generation time: about 12 minutes.
What you now have: Three distinct hero images ready to load into Klaviyo's A/B test. The composition is identical across all three — same layout, same product shot position, same headline size. Only the test variables differ. This is clean A/B testing: one variable changed per variant, controlled execution.
Time saved: A designer briefed on three variants would need a day minimum. This took 12 minutes of generation plus 20 minutes of JSON editing. The specialist stays in control of the creative without waiting for the design queue.
What to Do When It Breaks
- The model changes elements you didn't touch — Start a completely fresh conversation and re-upload the original image. Continuing an existing thread lets the model inherit context that overrides the JSON. Fresh conversations are non-negotiable for this workflow.
- Text rendering is blurry or wrong font weight — Add an explicit instruction at the top of your re-apply prompt: "Render all text elements with exactly the font weight specified in the JSON. Do not infer or soften any text styling." If it persists, upgrade from free tier to Advanced — text rendering fidelity is one of the clearest differences between tiers.
- The product image changes or distorts — Add a
"locked": truefield to any element you want fully preserved, then add this line to your prompt: "Any element marked locked: true must not be altered in any way — treat it as a fixed anchor." This gives the model an explicit constraint on protected elements. - The JSON extraction is incomplete or misses elements — Run the extraction twice and compare. If an element consistently goes missing, name it explicitly in the prompt: "Also identify and include the product image in the top-right corner and any decorative graphic elements."
- Gemini quota runs out — Switch to AI Studio at aistudio.google.com. It uses the same underlying model and is free. The workflow is identical — upload original image, paste modified JSON, same prompt.
Variations
- Simpler version: Skip JSON entirely for single-element edits. Upload the image and write: "Change only the CTA button background color to navy blue (#0D2B3E). Do not alter any other element." This works for one-off fixes but drifts more on complex images.
- Extended version: Maintain a master JSON library for each client or brand. Before any campaign launches, pull the brand's base template JSON, update only the campaign-specific fields (offer amount, promo code, dates), and generate. You never re-brief a designer for standard campaigns again.
- Multi-image consistency: Extract JSON from two reference images — one for layout, one for color scheme — then merge the JSON objects to create a hybrid that inherits layout from Image A and color palette from Image B. Useful when you inherit a new brand and want to adapt existing templates to a new visual identity.
What to Do Next
- This week: Run the extraction prompt on your three most-used email banner templates. Save the JSON files. You now have blueprints ready for every upcoming campaign.
- This month: The next time you produce A/B visual variants for a campaign, use this workflow instead of submitting a design request. Track the time difference. Build the case internally for making this the standard process.
- Advanced: Combine this workflow with your ESP's dynamic content blocks. Generate 3-4 banner variants via JSON editing, load them into Klaviyo as segment-specific images (one per audience tier), and let the ESP serve the right visual automatically. You get personalized creative at scale without a creative agency.
Advanced guide for Email Marketing Specialist professionals. Gemini Advanced ($20/month) produces the best results for complex image schemas; the free tier works for simpler banners with fewer elements.