JSON-Structured Image Decomposition: Test Assortment Combinations and Material Variations at Scale

Tools:Gemini
Time to build:1-2 hours
Difficulty:Advanced
Prerequisites:Comfortable with Gemini for writing and research tasks — see Level 3 guide: "Research Competitor Pricing and Assortment with Gemini"
Gemini

What This Builds

You upload a vendor's product photo to Gemini, extract a structured JSON blueprint of every visual element, then make targeted changes to specific fields. The result: a modified image showing exactly the colorway, material, or display combination you want to evaluate — without briefing a photographer, requesting new samples, or waiting for vendor reshoots.

One base image. Fifteen buying-decision variations. No studio costs.


Prerequisites

  • Active Gemini account at gemini.google.com — free tier works for color and material edits
  • Advanced subscription ($20/month) for better JSON schema adherence on complex multi-object changes
  • AI Studio (aistudio.google.com) as a free fallback when Pro quota runs out
  • Product photos available as image files (JPEG or PNG) — vendor-supplied, internal photography, or NuOrder/Joor catalog images

The Concept

When you change one word in a free-text image prompt, AI models tend to drift: the lighting shifts, a background element disappears, the angle changes. For a retail buyer testing colorways or material options, that drift is the problem. You need the jacket to stay the same jacket, just in navy instead of olive. You need the display fixture to stay put while you swap the folded inventory on the shelf.

JSON-structured prompting solves this by giving the AI an explicit, named contract for every element in the image. Think of it like a spec sheet for a purchase order. When you tell a vendor "change the fabrication from cotton-poly to 100% cotton," they don't redesign the silhouette. The JSON works the same way: it names every element, you change only what you mean to change, and the model treats everything else as fixed.

The three-step loop is always the same: extract the image's JSON blueprint, edit one or more fields, re-apply the modified JSON to the original image.


Build It Step by Step

Part 1: Extract the JSON Blueprint

Open Gemini at gemini.google.com and start a new conversation. Upload your product photo. Then paste this extraction prompt exactly:

Copy and paste this
Analyze this product image and return a structured JSON object describing every visual element. For each element include: name, color (specific shade, not just "blue"), material or texture, position in frame, size relative to the full image, and any visible finish (matte, glossy, textured, etc.).

Also include a top-level "scene" object with: background_color, background_texture, lighting_direction, shadow_presence, and shooting_angle.

Return only the JSON. No explanations.

Gemini will return something like this (abbreviated example for a women's cardigan):

Copy and paste this
{
  "scene": {
    "background_color": "off-white",
    "background_texture": "smooth seamless paper",
    "lighting_direction": "front-left",
    "shadow_presence": "soft drop shadow on right side",
    "shooting_angle": "straight-on, slight downward tilt"
  },
  "products": [
    {
      "name": "cardigan",
      "color": "warm camel",
      "material": "chunky ribbed knit, appears wool-blend",
      "position": "center frame",
      "size": "fills 70% of frame height",
      "finish": "matte, visible texture"
    },
    {
      "name": "buttons",
      "color": "tortoiseshell brown",
      "material": "resin",
      "position": "center-front placket",
      "size": "small, uniform",
      "finish": "semi-gloss"
    }
  ]
}

Copy the entire JSON response. Paste it into a text editor or a note. This is your blueprint.

Part 2: Make a Surgical Edit

In your text editor, change only the field or fields you want to test. Nothing else.

To test a colorway: Change "color": "warm camel" to "color": "deep forest green". Leave every other field untouched.

To test a material substitution: Change "material": "chunky ribbed knit, appears wool-blend" to "material": "fine merino knit, smooth". Leave color, buttons, and scene untouched.

To test both at once: Change the color and material fields simultaneously. The JSON will apply both changes in a single generation.

To test a display variation: Change the scene.background_color or scene.shooting_angle field to test how the product looks in a lifestyle context vs. a clean flat-lay.

Part 3: Re-Apply the Modified JSON

Open a fresh Gemini conversation (important: start new, don't continue the extraction chat). Upload the original product image again. Then paste:

Copy and paste this
Modify this image based on the following JSON prompt. Apply only the changes indicated by fields that differ from what you see in the image. Preserve all other visual elements exactly as they appear.

[paste your modified JSON here]

Gemini generates the modified image. Download it.

Repeat with additional JSON variants from the same base image — each in a fresh conversation with the same original photo attached.

Part 4: Assemble for Review

Once you have a set of variations, arrange them in a simple PowerPoint or Google Slides grid. Four or six images per slide. Label each with the JSON field you changed (colorway name, material spec, display context). This becomes your assortment mockup deck for the buying review meeting.


Real Example: Testing a Knitwear Buy for Fall

Setup: You're planning a fall women's knitwear buy. A vendor has sent one hero image: a camel chunky cardigan on a seamless white background, straight-on angle. You want to evaluate four colorways and two material grades before placing orders.

Extraction: Upload the image and run the extraction prompt. Gemini returns a JSON blueprint with the cardigan, buttons, and scene objects.

Edits you make to the JSON:

VersionJSON Fields Changed
Version 1cardigan.color → "ivory cream"
Version 2cardigan.color → "charcoal heather"
Version 3cardigan.color → "deep burgundy"
Version 4cardigan.color → "forest green"
Version 5cardigan.material → "fine merino knit, smooth, lightweight"
Version 6cardigan.material → "brushed mohair-blend, soft halo texture"

Process: Six separate Gemini conversations, same original image uploaded each time, six modified JSONs applied.

Output: Six realistic product images showing your candidate colorways and material grades. Total time: 25 minutes.

What you present: A single slide with all six images labeled. Your buying director sees the assortment story without waiting for vendor samples. You can make preliminary decisions before the line review meeting.

Time saved: Studio reshoots for six color and material variants would take 2-4 weeks and $500-1,500 in vendor photography fees. This took 25 minutes and $0.


What to Do When It Breaks

  • The model changes elements you didn't specify (background shifts, angle drifts, additional objects appear): Start a fresh conversation. Don't continue a prior thread. Re-upload the original image and paste the full JSON. The fresh-context approach suppresses drift.

  • Colors come out wrong or vague (Gemini generates "blue" when you asked for "deep navy with slight purple undertone"): Make the color description more specific in the JSON field. Add a Pantone reference if you have one ("PMS 289 C, dark navy"). More precise field values produce more precise results.

  • The JSON extraction misses an element you need to control (a belt, a tag, a hardware piece): Run the extraction again but add a line to your prompt: "Pay special attention to [element name] — include it as a separate object with full detail." Then edit that field in your blueprint.

  • Free tier generates lower-fidelity variations: Use AI Studio (aistudio.google.com) as a free alternative — same underlying model, separate quota.

  • Gemini refuses to generate the variation: The most common cause is ambiguous or conflicting instructions. Simplify the JSON to only the scene and the primary product object, remove any fields that aren't directly relevant to your edit, and try again.


Variations

Simpler version: Skip the full JSON extraction. Just upload a product photo and ask Gemini: "Regenerate this image with the jacket color changed to deep burgundy, keeping everything else identical." This works for simple single-change color tests. Use the full JSON workflow when you need to control multiple elements or produce more than 2-3 variants.

Extended version: Run JSON extraction on two different vendor images (say, a competitor's version of the same product category). Merge the scene block from one JSON with the product block from another to test how your vendor's item would look in the competitor's display context. This requires a third prompt step: "Merge these two JSON objects, using the 'scene' from JSON A and the 'products' from JSON B, then apply the merged JSON to [original image]."

For planogram testing: Use the scene fields (shooting angle, background, lighting direction) to simulate how a product would look on a shelf fixture vs. a folded display vs. a hanging rack. Change only the scene block. Leave the product JSON unchanged.


What to Do Next

  • This week: Run the workflow on one product you're currently evaluating. Practice the three-step loop (extract, edit one field, re-apply) before expanding to multi-field edits.
  • This month: Build a library of base JSONs for your core category items — cardigans, outerwear, footwear, whatever you buy. A saved blueprint means you skip the extraction step in future sessions.
  • Advanced: Combine this with your Category Intelligence Custom GPT. Upload vendor photos directly to a GPT session configured with your category context; use the JSON workflow to generate assortment variation sets, then feed the outputs to your buying presentation template automatically.

Advanced guide for Retail Buyer professionals. Gemini Advanced ($20/month) produces better results for complex multi-object variations; the free tier and AI Studio are adequate for simple colorway tests.