Examples

Real renders, real documents

Every image in sections 1 to 4 was rendered once from the JAI document shown with it and saved, so viewing the page needs no API key. Open "How this was rendered" under any of them to see the exact text sent to the model. Section 5 sets original photographs beside the encoder's renders and links each run's .jai file and full report.

1 · Minimal description

A sentence is a complete image

No settings at all. A description alone is a complete document in every place JAI lives: as the text of a marked image or a data:image/jai, URL, and as the canonical JSON inside a .jai file.

A red bicycle leaning against a sunlit whitewashed wall, with leaf shadows on the wall and cobblestones underneath.
A red bicycle leaning against a whitewashed wall, afternoon sun
How this was rendered

The renderer filled in everything the sentence left open: the cobblestones, the leaf shadows, the shutter. That is the trade JAI makes. You decide what matters and say it; the decoder invents the rest.

The same document in each of its three places: as the alt of a marked image, as a data: URL, and as the canonical JSON that a .jai file holds gzip-compressed.

<img src="bicycle.webp" alt="A red bicycle leaning against a whitewashed wall, afternoon sun" data-jai>
data:image/jai,A%20red%20bicycle%20leaning%20against%20a%20whitewashed%20wall,%20afternoon%20sun
{"jai":1,"prompt":"A red bicycle leaning against a whitewashed wall, afternoon sun"}
2 · Style variations

Same description, different style

Only the style setting changes between these three documents. The renderer, model and seed are the same, which is why the composition holds while the medium changes.

3 · Model preferences

One document, three renderers

The document says it prefers a FLUX model, then SDXL. Preferences are advisory: the reader's viewer chooses among the renderers its user has configured. Here the same document went to three of them.

A still life of pears on pewter, Dutch golden age;model=flux;model=sdxl;aspect=4:3

Note how each renderer read "Dutch golden age" differently. A JAI document fixes the intent, not the pixels. A model value is only ever matched against renderers the reader has set up; it never makes a viewer download or run anything.

4 · Image-conditioned rendering

Restyle the image already on the page

With mode=transform the page's own image becomes an input. strength says how far the result may move away from it: 0 keeps it, 1 ignores it.

The markup

<picture>
  <source type="image/jai"
          srcset="data:image/jai,Fishing%20boats%20in%20a%20small%20harbour%20at%20dawn,%20mist%20on%20the%20water,%20as%20a%20pencil%20sketch%20on%20cream%20paper;mode=transform;strength=0.7">
  <img src="harbour.webp" alt="Fishing boats moored in a misty harbour at dawn" crossorigin="anonymous">
</picture>

A viewer may only send pixels the page itself could read: same-origin images, or images served with CORS (hence crossorigin). It never uses the reader's cookies to fetch someone else's picture and send it to a provider.

5 · Encoding

From a photograph to a few hundred bytes

The reference encoder in jai-tools runs the decoder inside the loop. A vision model measures the original: where each subject is, how large, where the horizon lies. Every candidate description is rendered with two seeds and measured the same way, and an optimiser rewrites the descriptions from the measured differences ("the Earth is 1.7× too tall and 7% of the frame too high; the ground is too bright"). Both results below came from single, fully automatic runs for FLUX.1 schnell, picked by their measured fitness.

Earthrise: 64,374 bytes to 449

Photograph of a distant Earthrise over the Moon: one small, horizontally compressed blue-and-white Earth sits slightly right of centre, around one seventh of the frame wide, with its centre just below the middle of the square frame. Vast pure black, starless space fills nearly three quarters of the view. The lunar ground is dark gray-brown and lightly textured, occupying only the lowest quarter; its low curved horizon is very near the bottom edge, higher on the left and descending gently to the right. Even bright sunlight illuminates both Earth and lunar dust without glare.;aspect=1:1;avoid=text;avoid=stars;model=black-forest-labs/flux-schnell;style=Apollo space photography;style=natural realism

Seven generations, 29 candidates, 58 renders, about five minutes and $0.24 on Replicate. A second independent run of the same encoder reached the same fitness, 0.73. .jai file · full report with every candidate, measurement and cost.

Buzz Aldrin on the Moon: 280,403 bytes to 585

Photograph of a lone moon astronaut, near full height and slightly right of centre, standing at medium distance with helmet at the top and boots just below the middle. Bulky white Apollo suit, life-support backpack, chest controls, gray gloves, flag shoulder patch, and a large curved visor reflecting the sunlit terrain. The lunar horizon is a high shallow curve near the upper edge, with black empty sky above it. Gray dusty ground stretches from horizon to camera and visibly contains abundant overlapping bootprints, crisp sole patterns, pits and scattered rocks. Strong sunlight from upper right produces a massive dark shadow attached to the boots and stretching far toward the lower-left and bottom edge. A small gold foil-covered object is cropped along the lower-right edge.;aspect=1:1;avoid=stars;avoid=additional astronauts;model=black-forest-labs/flux-schnell;style=35mm archival space photograph;style=hard directional sunlight

Six generations, 30 candidates, 60 renders, about seven minutes and $0.26. .jai file · full report.

6 · Rendering modes

What a reader sees, step by step

A JAI-aware viewer shows the original image (or a tiny placeholder) while a render is on its way, swaps in the render, and keeps the original one click away. Choose a scenario and press Render. This demo plays back saved images; nothing is sent anywhere.

Scenario