A picture fitted into a box

One picture fitted into a box of one size eight ways: brought to four different sizes, stood against an edge, turned by a quarter and by an angle of its own, and mirrored — every panel drawn from the placement the rule worked out.

One picture, one box, eight answers. A fitting rule says how a picture is brought to the size of a box, where it sits in it, how much the box is shrunk first, and how far the picture is turned or mirrored on its way in. Every panel hands the same picture and the same box to a different rule.

Each panel then draws what comes back the same way: it applies the placement the rule worked out, then puts the picture down at its own size. Nothing is measured by hand anywhere. The panel that covers its whole box is the only one that overflows on purpose, so it is cut to the edge of that box.

What this example shows

  • Fit inside, cover, stretch, or leave at its own size.
  • Nine places to stand it, a margin inside the box, a rotation and a mirror.
  • One worked-out placement answering for all of it, applied the same way every time.

The code, in full

The same document is written twice, once in each language. Both files are shown in full, with the code coloured on the server, and can be copied in one click.

The document itself

The same document is written in each of these languages. Open the one you want to look at.

Open the document in English Open the document in French

Read the Rust source Read the Python source

First page of A picture fitted into a box

What this document weighs

Before 116,023 bytes
Now 45,312 bytes
Saved 60.9 %

Not one mark on the page changed. See every document measured.

Examples near this one

QR codes

A page of QR codes, drawn as squares.

Every example, by subject