Row splitting and mixed ratios
"At most five per row" is a ceiling, not a target. The packer keeps the row height readable first, then decides how many rows the group needs.
Two images: about a third of the column


Two 3:2 photos side by side give a row height of roughly a third of the column width. High enough for detail, short enough to keep the page moving.
Five images: automatically 3 + 2





"Max five per row" is a ceiling. Force five mixed images into one row and each cell is about 120px tall; split into 3 + 2 and the rows get 205px and 296px.
So the default result is 3 + 2, not five in a row. This is the most common surprise: the setting says 5, the page shows two rows.
Seven images: name the first rows with ag:rows



...ag:rows=5,2 goes on the first image of the group and means "five in the first row, two in the second". It describes the opening rows, not the whole group:
- Consumed in order, truncated at the end: six pictures with
ag:rows=4,3,1give four, then the two that are left — there is no third row. - A short list hands the rest to packing: six pictures with
ag:rows=2,3give "two, three, one (packed)";ag:rows=2on six routes the remaining four by ratio and minimum height. - No picture is ever lost: adding or deleting an image never invalidates the whole annotation; at worst it describes fewer rows than the group has.
- A named row skips the minimum row height and is not bound by "max per row" — that ceiling governs automatic packing only.
Only a person writes ag:rows: no drag injects it, and releasing a row binding returns the group to automatic routing (bind with ag:group when members must stay together).
Mixed ratios



When an extreme strip shares a row with a portrait, the row height is solved from "the whole row exactly fills the column". The more extreme the ratio, the further its cell deviates from the average width — but every cell ends up the same height.
ag:rows versus ag:group
| Parameter | What it does | Written on | Side effect |
|---|---|---|---|
ag:rows=3,2 | names how many images each of the opening rows holds; the rest is packed | first image of the group | skips the minimum row height and the max-per-row ceiling |
ag:group=1 | binds a row so packing never splits or merges it | every image | adjacent rows need different ids |
ag:group says "do not take me apart"; ag:rows says "cut the opening rows here". One is a constraint, the other an instruction.
Related settings
| Setting | Default | Effect |
|---|---|---|
| Gallery max per row | 5 | ceiling per row |
| Gallery min height | 100 | below this, the packer keeps splitting |
| Gallery layout control | count and height | switch to count-only or height-only |
Next
- Row height and orphans
- Gallery handles: a drag writes
ag:cropandag:grouponly